/* Generated from Java with JSweet 3.0.0 - http://www.jsweet.org */
var com;
(function (com) {
    var example;
    (function (example) {
        /**
         * @author
         * @date 2021/1/18 10:53
         * @class
         */
        class App {
            static main(officialGameData, myGameData, rewardAndCount) {
                return new Promise(resolve => {
                    let result = getMaterialAndRewardFromJson(rewardAndCount)
                    let TopResult = App.defaultTask(officialGameData, myGameData, result);
                    resolve(TopResult)
                });
                //App.testTask(officialGameData, myGameData);
            }

            static defaultTask(officialGameData, myGameData, rewardAndCount) {
                const reward = rewardAndCount.reward;
                const materialCount = rewardAndCount.materialCount;
                const inference = new com.example.calculation.GodInference(reward, materialCount, officialGameData, myGameData);
                return inference.refere();
            }

            static testTask(officialGameData, myGameData) {
                const reward = new Array(10000).fill(1);
                const materialCount = new Array(47).fill(50);
                const inference = new com.example.calculation.GodInference(reward, materialCount, officialGameData, myGameData);
                inference.refere();
            }
        }

        example.App = App;
        App["__class"] = "com.example.App";
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            /**
             * @author hushuaibo
             * @date 2020/9/28 22:50
             * @class
             */
            class CacheKitchenGodCal {
                constructor() {
                    this.qualityAdd = [-1, 0, 0.1, 0.3, 0.5, 1.0];
                    this.quality = (function (dims) {
                        let allocate = function (dims) {
                            if (dims.length === 0) {
                                return 0;
                            } else {
                                let array = [];
                                for (let i = 0; i < dims[0]; i++) {
                                    array.push(allocate(dims.slice(1)));
                                }
                                return array;
                            }
                        };
                        return allocate(dims);
                    })([2000, 400]);
                    this.initDivisionResult();
                }

                /*private*/
                initDivisionResult() {
                    const one = this.quality.length;
                    const two = this.quality[0].length;
                    for (let i = 1; i < one; i++) {
                        {
                            for (let i2 = 1; i2 < two; i2++) {
                                {
                                    this.quality[i][i2] = (i / i2 | 0);
                                }

                            }
                        }

                    }
                    for (let i = 1; i < one; i++) {
                        {
                            this.quality[i][0] = -1;
                        }
                    }
                }

                /**
                 * 用于计算在没有厨具的情况下，一个菜可以达到的品质
                 * <p>
                 * 虽然没有厨具，但考虑厨师可能会有一些技法加成，让本身不能做的菜谱，但如果这个菜得分很高
                 * 厨师带着加上100技法的厨具就可以做，则判定为品质加成为0，
                 * 如果菜谱需要两项技法，而且厨师两项技法都不达标，则直接判定为不能做
                 * @param {com.example.entity.Chef} chef
                 * @param {com.example.calculation.SkillEffect} effect
                 * @param {com.example.entity.CalRecipe} recipe
                 * @return {double[]}
                 */
                QualityAddNoEquip(chef, effect, recipe) {
                    let ratio = 5;
                    let t;
                    let hasFailOnce = false;
                    let s;
                    if (recipe.bake !== 0) {
                        s = (chef.bake + effect.bake) * (1 + effect.bakePercent);
                        t = this.quality[(s | 0)][recipe.bake];
                        if (t < 1 && !hasFailOnce) {
                            hasFailOnce = true;
                            t = this.quality[(s | 0) + 100][recipe.bake];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.boil !== 0) {
                        s = (chef.boil + effect.boil) * (1 + effect.boilPercent);
                        t = this.quality[(s | 0)][recipe.boil];
                        if (t < 1 && !hasFailOnce) {
                            hasFailOnce = true;
                            t = this.quality[(s | 0) + 100][recipe.boil];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.stirfry !== 0) {
                        s = (chef.stirfry + effect.stirfry) * (1 + effect.stirfryPercent);
                        t = this.quality[(s | 0)][recipe.stirfry];
                        if (t < 1 && !hasFailOnce) {
                            hasFailOnce = true;
                            t = this.quality[(s | 0) + 100][recipe.stirfry];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.knife !== 0) {
                        s = (chef.knife + effect.knife) * (1 + effect.knifePercent);
                        t = this.quality[(s | 0)][recipe.knife];
                        if (t < 1 && !hasFailOnce) {
                            hasFailOnce = true;
                            t = this.quality[(s | 0) + 100][recipe.knife];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.fry !== 0) {
                        s = (chef.fry + effect.fry) * (1 + effect.fryPercent);
                        t = this.quality[(s | 0)][recipe.fry];
                        if (t < 1 && !hasFailOnce) {
                            hasFailOnce = true;
                            t = this.quality[(s | 0) + 100][recipe.fry];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.steam !== 0) {
                        s = (chef.steam + effect.steam) * (1 + effect.steamPercent);
                        t = this.quality[(s | 0)][recipe.steam];
                        if (t < 1 && !hasFailOnce) {
                            hasFailOnce = true;
                            t = this.quality[(s | 0) + 100][recipe.steam];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    return [this.qualityAdd[(ratio | 0)], hasFailOnce ? 1 : 0];
                }

                QualityAdd(chef, effect, recipe) {
                    let ratio = 5;
                    let t;
                    let s;
                    if (recipe.bake !== 0) {
                        s = (chef.bake + effect.bake) * (1 + effect.bakePercent);
                        if (s < 0) {
                            return -1;
                        } else {
                            t = this.quality[(s | 0)][recipe.bake];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.boil !== 0) {
                        s = (chef.boil + effect.boil) * (1 + effect.boilPercent);
                        if (s < 0) {
                            return -1;
                        } else {
                            t = this.quality[(s | 0)][recipe.boil];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.stirfry !== 0) {
                        s = (chef.stirfry + effect.stirfry) * (1 + effect.stirfryPercent);
                        if (s < 0) {
                            return -1;
                        } else {
                            t = this.quality[(s | 0)][recipe.stirfry];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.knife !== 0) {
                        s = (chef.knife + effect.knife) * (1 + effect.knifePercent);
                        if (s < 0) {
                            return -1;
                        } else {
                            t = this.quality[(s | 0)][recipe.knife];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.fry !== 0) {
                        s = (chef.fry + effect.fry) * (1 + effect.fryPercent);
                        if (s < 0) {
                            return -1;
                        } else {
                            t = this.quality[(s | 0)][recipe.fry];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    if (recipe.steam !== 0) {
                        s = (chef.steam + effect.steam) * (1 + effect.steamPercent);
                        if (s < 0) {
                            return -1;
                        } else {
                            t = this.quality[(s | 0)][recipe.steam];
                        }
                        ratio = t < ratio ? t : ratio;
                    }
                    let c = (ratio | 0);
                    c = c < 0 ? 0 : c;
                    return this.qualityAdd[c];
                }

                skillAdd(effect, recipe) {
                    let add = 0;
                    if (recipe.bake !== 0) {
                        add += (effect.usebake);
                    }
                    if (recipe.boil !== 0) {
                        add += (effect.useboil);
                    }
                    if (recipe.stirfry !== 0) {
                        add += (effect.usestirfry);
                    }
                    if (recipe.knife !== 0) {
                        add += (effect.useknife);
                    }
                    if (recipe.fry !== 0) {
                        add += (effect.usefry);
                    }
                    if (recipe.steam !== 0) {
                        add += (effect.usesteam);
                    }
                    const tags = recipe.tags;
                    add += (effect.usecreation * tags[0]) + (effect.usemeat * tags[1]) + (effect.usevegetable * tags[2]) + (effect.usefish * tags[3]);
                    return add;
                }
            }

            calculation.CacheKitchenGodCal = CacheKitchenGodCal;
            CacheKitchenGodCal["__class"] = "com.example.calculation.CacheKitchenGodCal";
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            /**
             * ChefAndRecipeThread类用于计算 厨师和菜谱组合后，得分情况
             * @param {number} start
             * @param {number} limit
             * @class
             */
            class ChefAndRecipeThread {
                constructor(start, limit) {
                    if (this.playRecipes === undefined) {
                        this.playRecipes = null;
                    }
                    if (this.playChefs === undefined) {
                        this.playChefs = null;
                    }
                    if (this.start === undefined) {
                        this.start = 0;
                    }
                    if (this.limit === undefined) {
                        this.limit = 0;
                    }
                    this.scoreCache = null;
                    if (this.scoreCacheNoEquipIndex === undefined) {
                        this.scoreCacheNoEquipIndex = null;
                    }
                    if (this.scoreAddCacheNoEquip === undefined) {
                        this.scoreAddCacheNoEquip = null;
                    }
                    if (this.recipe2Change === undefined) {
                        this.recipe2Change = null;
                    }
                    this.start = start;
                    this.limit = limit;
                }

                static __static_initialize() {
                    if (!ChefAndRecipeThread.__static_initialized) {
                        ChefAndRecipeThread.__static_initialized = true;
                        ChefAndRecipeThread.__static_initializer_0();
                    }
                }

                static disordePermuation_$LI$() {
                    ChefAndRecipeThread.__static_initialize();
                    if (ChefAndRecipeThread.disordePermuation == null) {
                        ChefAndRecipeThread.disordePermuation = (function (dims) {
                            let allocate = function (dims) {
                                if (dims.length === 0) {
                                    return 0;
                                } else {
                                    let array = [];
                                    for (let i = 0; i < dims[0]; i++) {
                                        array.push(allocate(dims.slice(1)));
                                    }
                                    return array;
                                }
                            };
                            return allocate(dims);
                        })([1680, 9]);
                    }
                    return ChefAndRecipeThread.disordePermuation;
                }

                static __static_initializer_0() {
                    const needPermuation = [0, 1, 2, 3, 4, 5, 6, 7, 8];
                    ChefAndRecipeThread.permute(needPermuation, [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0], 0);
                }

                setBaseData(playRecipes, playChefs, recipe2Change, tempCalCache) {
                    this.playRecipes = playRecipes;
                    this.playChefs = playChefs;
                    this.scoreCache = tempCalCache.socreCacheNoEquip;
                    this.scoreCacheNoEquipIndex = tempCalCache.socreCacheNoEquipIndex;
                    this.scoreAddCacheNoEquip = tempCalCache.socreAddCacheNoEquip;
                    this.recipe2Change = recipe2Change;

                    if (Module != null && Module.inited == undefined) {
                        let memoryAddress1 = arrayToIntMemorySegment(this.playRecipes);
                        let memoryAddress2 = arrayToIntMemorySegment(this.playChefs);

                        let MemorySegment3 = new Int32Array(this.recipe2Change.length + 1);
                        MemorySegment3[0] = this.recipe2Change.length;

                        for (let i = 0; i < recipe2Change.length; i++) {
                            MemorySegment3[i + 1] = this.recipe2Change[i];
                        }
                        let memoryAddress3 = Module._malloc((this.recipe2Change.length + 1) * 4);
                        Module.HEAP32.set(MemorySegment3, memoryAddress3 >> 2);

                        let memoryAddress4 = arrayToIntMemorySegment(this.scoreCacheNoEquipIndex);
                        let memoryAddress5 = arrayToIntMemorySegment(this.scoreAddCacheNoEquip);
                        let disordePermuation = ChefAndRecipeThread.disordePermuation_$LI$()
                        let memoryAddress6 = arrayToShortMemorySegment(disordePermuation);

                        Module._init(memoryAddress1, memoryAddress2, memoryAddress3, memoryAddress4, memoryAddress5, memoryAddress6)
                        Module.inited = true;
                    }


                }

                /**
                 * @return {long[]} 返回得分最高的tomNum个结果，结果是有序的，已经按照得分从高到底排序了
                 */
                call() {
                    try {
                        let starttime = 0;
                        let endtime = 0;
                        let topKValue = 0;
                        starttime = Date.now();
                        let index = 0;
                        const scores = (s => {
                            let a = [];
                            while (s-- > 0)
                                a.push(0);
                            return a;
                        })(1680 * this.playChefs.length + ChefAndRecipeThread.tomNum);
                        let score1Index;
                        let score2Index;
                        let score3Index;
                        for (let i = this.start; i < this.limit; i++) {
                            {
                                const precipes = this.playRecipes[i];
                                let cal = 0;
                                let cal2 = 0;
                                for (let k = 0; k < 1680; k++) {
                                    {
                                        const ints = ChefAndRecipeThread.disordePermuation_$LI$()[k];
                                        score1Index = this.scoreCacheNoEquipIndex[precipes[ints[0]]][precipes[ints[1]]] + (precipes[ints[2]] - precipes[ints[1]] - 1);
                                        score2Index = this.scoreCacheNoEquipIndex[precipes[ints[3]]][precipes[ints[4]]] + (precipes[ints[5]] - precipes[ints[4]] - 1);
                                        score3Index = this.scoreCacheNoEquipIndex[precipes[ints[6]]][precipes[ints[7]]] + (precipes[ints[8]] - precipes[ints[7]] - 1);
                                        let score2 = 0;
                                        let i9 = 0;
                                        for (let index121 = 0; index121 < this.recipe2Change.length; index121++) {
                                            let chef2Limit = this.recipe2Change[index121];
                                            {
                                                const playChef = this.playChefs[i9];
                                                score2 = this.scoreAddCacheNoEquip[playChef[0]][score1Index] + this.scoreAddCacheNoEquip[playChef[1]][score2Index];
                                                if(score2==0){
                                                    continue;
                                                }
                                                chef2Limit = chef2Limit - 1;
                                                for (; i9 < chef2Limit; i9 += 2) {
                                                    {
                                                        cal = score2 + this.scoreAddCacheNoEquip[this.playChefs[i9][2]][score3Index];
                                                        cal2 = score2 + this.scoreAddCacheNoEquip[this.playChefs[i9 + 1][2]][score3Index];
                                                        if (cal > topKValue) {
                                                            let bigCal = BigInt(cal);
                                                            bigCal = ((((bigCal << 18n | BigInt(i)) << 11n) | BigInt(k)) << 14n) | BigInt(i9);
                                                            scores[index++] = bigCal;
                                                        }
                                                        if (cal2 > topKValue) {
                                                            let bigCal = BigInt(cal2);
                                                            bigCal = ((((bigCal << 18n | BigInt(i)) << 11n) | BigInt(k)) << 14n) | BigInt(i9 + 1);
                                                            scores[index++] = bigCal;
                                                        }
                                                    }
                                                }
                                                if (chef2Limit === i9) {
                                                    cal = score2 + this.scoreAddCacheNoEquip[this.playChefs[i9][2]][score3Index];
                                                    if (cal > topKValue) {
                                                        let bigCal = BigInt(cal);
                                                        bigCal = ((((bigCal << 18n | BigInt(i)) << 11n) | BigInt(k)) << 14n) | BigInt(i9);
                                                        scores[index++] = bigCal;
                                                    }
                                                    i9++;
                                                }
                                            }
                                        }
                                    }
                                }
                                if ((index - ChefAndRecipeThread.tomNum) > 0) {
                                    topKValue = com.example.collection.BFPRT.bfprt(scores, 0, index, index - ChefAndRecipeThread.tomNum);
                                    let newIndex = 0;
                                    for (let j = 0; j < index; j++) {
                                        {
                                            if (scores[j] > topKValue) {
                                                scores[newIndex++] = scores[j];
                                            }
                                        }
                                    }
                                    index = newIndex;
                                }
                            }
                        }
                        const resultScores = (s => {
                            let a = [];
                            while (s-- > 0)
                                a.push(0);
                            return a;
                        })((index - ChefAndRecipeThread.tomNum) > 0 ? ChefAndRecipeThread.tomNum : index);
                        topKValue = 0;
                        if ((index - ChefAndRecipeThread.tomNum) > 0) {
                            topKValue = com.example.collection.BFPRT.bfprt(scores, 0, index, index - ChefAndRecipeThread.tomNum);
                        }
                        for (let i = 0, k = 0; i < index; i++) {
                            {
                                if (scores[i] > topKValue) {
                                    resultScores[k++] = scores[i];
                                }
                            }
                        }
                        endtime = /* currentTimeMillis */ Date.now();
                        console.info((this.limit - this.start) + "\u7ec4\u83dc\u8c31,\u5168\u53a8\u5e08\u6392\u5217\u7ed3\u679c\u7528\u65f6:" + (endtime - starttime) + "ms");
                        return resultScores;
                    } catch (e) {
                        console.error(e.message, e);
                        return null;
                    }
                }

                callWasm() {
                    /**
                     * Module._call返回计算后的数组（long[]），但是wasm返回的其实是数组的起偏移量，相对于 Module的内存段
                     * resultOffset是偏移量
                     *
                     * */
                    let resultOffset = Module._call(0, 60, 0);

                    /**
                     * 返回值是8字节为一个数，第一个数代表数组长度，往后是计算结果
                     *
                     * */
                    let memory = Module.HEAPU8.subarray(resultOffset, resultOffset + 8)
                    let arrayBuffer = new Uint8Array(8);
                    for (let i = 0; i < 8; i++) {
                        arrayBuffer[i] = memory[i];
                    }
                    //获取返回数组长度

                    let lengthView = new DataView(arrayBuffer.buffer, 0, 8);
                    let arrayLength = parseInt(lengthView.getBigInt64(0, true)) - 1;


                    arrayBuffer = new Uint8Array(arrayLength * 8);

                    memory = Module.HEAPU8.subarray(resultOffset + 8)
                    for (let i = 0; i < arrayLength * 8; i++) {
                        arrayBuffer[i] = memory[i];
                    }
                    let dataView = new DataView(arrayBuffer.buffer);

                    let TopResult = new Array(arrayLength);

                    const size = arrayLength * 8;
                    // 内存中数据是小端模式
                    for (let i = 0, index = 0; i < size; i += 8, index++) {
                        TopResult[index] = dataView.getBigInt64(i, true)
                    }

                    return TopResult;
                }


                static permute(need, tmp, count, start) {
                    if ((count[0] + count[1] + count[2]) === 9) {
                        for (let i = 0; i < 9; i++) {
                            {
                                ChefAndRecipeThread.disordePermuation_$LI$()[ChefAndRecipeThread.index][i] = tmp[i];
                            }
                        }
                        ChefAndRecipeThread.index++;
                        return;
                    }
                    for (let j = 0; j < 3; j++) {
                        {
                            if (count[j] === 3) {
                                continue;
                            }
                            tmp[(j * 3) + count[j]] = need[start];
                            count[j]++;
                            ChefAndRecipeThread.permute(need, tmp, count, start + 1);
                            count[j]--;
                        }

                    }
                }
            }

            ChefAndRecipeThread.__static_initialized = false;
            ChefAndRecipeThread.tomNum = 200000;
            /**
             * 将一组有序的菜谱排列，  生成其所有的无序排列情况
             * 这里的排序可以理解为，有三个桶，每个桶中可以放三个元素（桶中元素不考虑顺序）， 计算有多少种放置方法
             *
             * @param playress 有序的菜谱排列
             * @param start    当前排列的元素（0-8）
             * @param count    记录一组无序排列情况中，排列元素个数
             */
            ChefAndRecipeThread.index = 0;
            calculation.ChefAndRecipeThread = ChefAndRecipeThread;
            ChefAndRecipeThread["__class"] = "com.example.calculation.ChefAndRecipeThread";
            ChefAndRecipeThread["__interfaces"] = ["java.util.concurrent.Callable"];
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            /**
             * @author hushuaibo
             * @date 2020/10/4 9:31
             * @param {com.example.collection.EquipTree[]} playEquips
             * @param {com.example.calculation.TopResult[]} topResults
             * @param {number} max
             * @param {com.example.entity.GlobalDate} globalDate
             * @param {number} start
             * @param {number} limit
             * @class
             */
            class ChefEquipRecipeThread {
                constructor(playEquips, topResults, max, globalDate, start, limit) {
                    this.gaobao = 999999;
                    if (this.playEquips === undefined) {
                        this.playEquips = null;
                    }
                    if (this.topResults === undefined) {
                        this.topResults = null;
                    }
                    if (this.tempCalCache === undefined) {
                        this.tempCalCache = null;
                    }
                    if (this.max === undefined) {
                        this.max = null;
                    }
                    if (this.start === undefined) {
                        this.start = 0;
                    }
                    if (this.limit === undefined) {
                        this.limit = 0;
                    }
                    if (this.scoreCache === undefined) {
                        this.scoreCache = null;
                    }
                    if (this.ownChefs === undefined) {
                        this.ownChefs = null;
                    }
                    if (this.ownRecipes === undefined) {
                        this.ownRecipes = null;
                    }
                    if (this.ownEquips === undefined) {
                        this.ownEquips = null;
                    }
                    this.playEquips = playEquips;
                    this.topResults = topResults;
                    this.max = max;
                    this.ownChefs = globalDate.ownChefs;
                    this.ownEquips = globalDate.ownEquips;
                    this.ownRecipes = globalDate.ownRecipes;
                    this.tempCalCache = globalDate.tempCalCache;
                    this.start = start;
                    this.limit = limit;
                    this.scoreCache = this.tempCalCache.scoreCache;
                }

                /**
                 *
                 * @return {number}
                 */
                call() {
                    let result = []
                    let starttime;
                    let endtime;
                    starttime = /* currentTimeMillis */ Date.now();
                    let cal, cal2;
                    let curTop;
                    let recipes = [];
                    let chefs = [];
                    const equips = [];
                    const playEquips = this.playEquips;
                    for (let i = this.start; i < this.limit; i++) {
                        {
                            curTop = this.topResults[i];
                            recipes = curTop.recepeids;
                            chefs = curTop.chefs;
                            const recipe6 = recipes[6];
                            const recipe7 = recipes[7];
                            const recipe8 = recipes[8];
                            let score1 = 0;
                            let score2 = 0;
                            let recipeScore;
                            for (let t1 = 0; t1 < playEquips.length; t1++) {
                                {
                                    const root1 = playEquips[t1];
                                    recipeScore = this.scoreCache[chefs[0]][root1.index];
                                    score1 = recipeScore[recipes[0]] + recipeScore[recipes[1]] + recipeScore[recipes[2]];
                                    const children = root1.children;
                                    for (let t2 = 0; t2 < children.length; t2++) {
                                        {
                                            const root2 = children[t2];
                                            recipeScore = this.scoreCache[chefs[1]][root2.index];
                                            score2 = score1 + recipeScore[recipes[3]] + recipeScore[recipes[4]] + recipeScore[recipes[5]];
                                            const root3s = root2.leaves;
                                            const root3sLength = root3s.length - 1;
                                            let t3 = 0;
                                            for (const chef2 = chefs[2]; t3 < root3sLength; t3 += 2) {
                                                {
                                                    recipeScore = this.scoreCache[chef2][root3s[t3]];
                                                    cal = score2 + (recipeScore[recipe6] + recipeScore[recipe7] + recipeScore[recipe8]);
                                                    recipeScore = this.scoreCache[chef2][root3s[t3 + 1]];
                                                    cal2 = score2 + (recipeScore[recipe6] + recipeScore[recipe7] + recipeScore[recipe8]);
                                                    if (cal > this.max) {
                                                        let equips = [root1.index, root2.index, root3s[t3]]
                                                        result.push(this.createResultObject(chefs, equips, recipes, this.max, cal));
                                                        this.max = cal;
                                                    }
                                                    if (cal2 > this.max) {
                                                        let equips = [root1.index, root2.index, root3s[t3 + 1]]
                                                        result.push(this.createResultObject(chefs, equips, recipes, this.max, cal2));
                                                        this.max = cal;
                                                    }
                                                }
                                            }
                                            if (root3sLength === t3) {
                                                recipeScore = this.scoreCache[chefs[2]][root3s[t3]];
                                                cal = score2 + (recipeScore[recipe6] + recipeScore[recipe7] + recipeScore[recipe8]);
                                                if (cal > this.max) {
                                                    let equips = [root1.index, root2.index, root3s[t3]];
                                                    result.push(this.createResultObject(chefs, equips, recipes, this.max, cal));
                                                    this.max = cal;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    endtime = /* currentTimeMillis */ Date.now();
                    console.info((this.limit - this.start) + "\u7ec4\u83dc\u8c31\u53a8\u5e08\u6392\u5217,\u5168\u53a8\u5177\u7528\u65f6:" + (endtime - starttime) + "ms");
                    return result;
                }

                createResultObject(chefIndexs, equipIndexs, recipes, oldInt, score) {
                    let newTopChef = {
                        chefs: new Array(3),
                        score: score
                    };


                    for (let i = 0; i < 3; i++) {

                        if (this.ownEquips[equipIndexs[i]] == null) {
                            debugger
                        }

                        let chefObject = {
                            chef: this.ownChefs[chefIndexs[i]].name,
                            equip: this.ownEquips[equipIndexs[i]].name,
                            recipes: [
                                {
                                    recipe: this.ownRecipes[recipes[(i * 3)]].name,
                                    count: this.ownRecipes[recipes[(i * 3)]].count,
                                }, {
                                    recipe: this.ownRecipes[recipes[(i * 3) + 1]].name,
                                    count: this.ownRecipes[recipes[(i * 3) + 1]].count,
                                }, {
                                    recipe: this.ownRecipes[recipes[(i * 3) + 2]].name,
                                    count: this.ownRecipes[recipes[(i * 3) + 2]].count,
                                }
                            ]
                        }
                        newTopChef.chefs[i] = chefObject;
                    }
                    return newTopChef;
                }

            }

            calculation.ChefEquipRecipeThread = ChefEquipRecipeThread;
            ChefEquipRecipeThread["__class"] = "com.example.calculation.ChefEquipRecipeThread";
            ChefEquipRecipeThread["__interfaces"] = ["java.util.concurrent.Callable"];
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            /**
             * 全局的技法，售价等加成
             *
             * 创建好GlobalAddtion对象后 ，因该直接将六维属性赋值好，
             *
             *
             * @param {com.example.entity.Chef[]} chefs
             * @param {com.example.entity.Skill[]} skills1
             * @class
             */
            class GlobalAddtion {
                constructor(chefs, skills1) {
                    if (((chefs != null && chefs instanceof Array) || chefs === null) && ((skills1 != null && (skills1 instanceof Array)) || skills1 === null)) {
                        if (this.bake === undefined) {
                            this.bake = 0;
                        }
                        if (this.boil === undefined) {
                            this.boil = 0;
                        }
                        if (this.stirfry === undefined) {
                            this.stirfry = 0;
                        }
                        if (this.knife === undefined) {
                            this.knife = 0;
                        }
                        if (this.fry === undefined) {
                            this.fry = 0;
                        }
                        if (this.steam === undefined) {
                            this.steam = 0;
                        }
                        if (this.manfill === undefined) {
                            this.manfill = 0;
                        }
                        if (this.womanfill === undefined) {
                            this.womanfill = 0;
                        }
                        if (this.price === undefined) {
                            this.price = 0;
                        }
                        this.useall = [0, 0, 0, 0, 0, 0];
                        this.maxequiplimit = [0, 0, 0, 0, 0, 0];
                        const chefs1 = (s => {
                            let a = [];
                            while (s-- > 0)
                                a.push(null);
                            return a;
                        })(chefs.length);
                        for (let i = 0; i < chefs1.length; i++) {
                            {
                                chefs1[i] = chefs[i];
                            }

                        }
                        this.init$com_example_entity_Chef_A$java_util_List(chefs1, skills1);
                    } else if (((chefs != null && chefs instanceof com.example.entity.OfficialGameData) || chefs === null) && skills1 === undefined) {
                        let __args = arguments;
                        let officialGameData = __args[0];
                        if (this.bake === undefined) {
                            this.bake = 0;
                        }
                        if (this.boil === undefined) {
                            this.boil = 0;
                        }
                        if (this.stirfry === undefined) {
                            this.stirfry = 0;
                        }
                        if (this.knife === undefined) {
                            this.knife = 0;
                        }
                        if (this.fry === undefined) {
                            this.fry = 0;
                        }
                        if (this.steam === undefined) {
                            this.steam = 0;
                        }
                        if (this.manfill === undefined) {
                            this.manfill = 0;
                        }
                        if (this.womanfill === undefined) {
                            this.womanfill = 0;
                        }
                        if (this.price === undefined) {
                            this.price = 0;
                        }
                        this.useall = [0, 0, 0, 0, 0, 0];
                        this.maxequiplimit = [0, 0, 0, 0, 0, 0];
                        this.init$com_example_entity_OfficialGameData(officialGameData);
                    } else
                        throw new Error('invalid overload');
                }

                init$com_example_entity_Chef_A$java_util_List(chefs, skills1) {
                    const skills = (new Map());
                    for (let index122 = 0; index122 < skills1.length; index122++) {
                        let skill = skills1[index122];
                        {
                            skills.set(skill.skillId, skill);
                        }
                    }
                    for (let index123 = 0; index123 < chefs.length; index123++) {
                        let chef = chefs[index123];
                        {
                            if (this.hasXiuLian(chef)) {
                                const skill = skills.get(chef.ultimateSkill);
                                if (skill == null) {
                                    continue;
                                }
                                for (let index124 = 0; index124 < skill.effect.length; index124++) {
                                    let effect = skill.effect[index124];
                                    {
                                        this.parseEffect(effect);
                                    }
                                }
                            }
                            const skill = skills.get(chef.skill);
                            if (skill == null) {
                                continue;
                            }
                            for (let index125 = 0; index125 < skill.effect.length; index125++) {
                                let effect = skill.effect[index125];
                                {
                                    this.parseEffect(effect);
                                }
                            }
                        }
                    }
                    for (let i = 0; i < this.useall.length; i++) {
                        {
                            this.useall[i] = this.useall[i] / 100;
                        }
                        ;
                    }
                    this.manfill = (n => n < 0 ? Math.ceil(n) : Math.floor(n))(this.manfill / 6);
                    this.womanfill = (n => n < 0 ? Math.ceil(n) : Math.floor(n))(this.womanfill / 6);
                }

                init(chefs, skills1) {
                    if (((chefs != null && chefs instanceof Array && (chefs.length == 0 || chefs[0] == null || (chefs[0] != null && chefs[0] instanceof com.example.entity.Chef))) || chefs === null) && ((skills1 != null && (skills1 instanceof Array)) || skills1 === null)) {
                        return this.init$com_example_entity_Chef_A$java_util_List(chefs, skills1);
                    } else if (((chefs != null && chefs instanceof com.example.entity.OfficialGameData) || chefs === null) && skills1 === undefined) {
                        return this.init$com_example_entity_OfficialGameData(chefs);
                    } else
                        throw new Error('invalid overload');
                }

                parseEffect(effect) {
                    const type = effect.type;
                    if (effect.condition === ("Global")) {
                        if (effect.tag != null) {
                            if (effect.tag === 1) {
                                this.manfill = this.manfill + effect.value;
                            } else if (effect.tag === 2) {
                                this.womanfill = this.womanfill + effect.value;
                            }
                        } else {
                            switch ((type)) {
                                case "Bake":
                                    this.bake = this.bake + effect.value;
                                    break;
                                case "Steam":
                                    this.steam = this.steam + effect.value;
                                    break;
                                case "Boil":
                                    this.boil = this.boil + effect.value;
                                    break;
                                case "Fry":
                                    this.fry = this.fry + effect.value;
                                    break;
                                case "Knife":
                                    this.knife = this.knife + effect.value;
                                    break;
                                case "Stirfry":
                                    this.stirfry = this.stirfry + effect.value;
                                    break;
                                case "MaxEquipLimit":
                                    this.maxequiplimit[effect.rarity] += effect.value;
                                    break;
                                case "UseAll":
                                    this.useall[effect.rarity] += effect.value;
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                }

                init$com_example_entity_OfficialGameData(officialGameData) {
                    const skills1 = officialGameData.skills;
                    const chefs = officialGameData.chefs;
                    this.init$com_example_entity_Chef_A$java_util_List(/* toArray */ chefs.slice(0), skills1);
                }

                hasXiuLian(chef) {
                    return chef.ultimateSkill != null;

                }
            }

            calculation.GlobalAddtion = GlobalAddtion;
            GlobalAddtion["__class"] = "com.example.calculation.GlobalAddtion";
            GlobalAddtion["__interfaces"] = ["java.io.Serializable"];
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            /**
             * 厨神大赛 厨师菜谱厨具组合得分推演
             * @param {double[]} rewardlsit
             * @param {int[]} materials
             * @param {com.example.entity.OfficialGameData} officialGameData
             * @param {com.example.entity.MyGameData} myGameData
             * @class
             */
            class GodInference {
                constructor(rewardlsit, materials, officialGameData, myGameData) {
                    this.topcount = 3000;
                    this.segmentnums = 300;
                    this.vCPU = 1;
                    this.chefMinRaritySum = 14;
                    this.equipMinRarity = 2;
                    this.equipMaxRarity = 3;
                    this.deepLimit = [0, 4, 3, 3, 2, 2, 2, 2, 2, 2];
                    if (this.officialGameData === undefined) {
                        this.officialGameData = null;
                    }
                    if (this.myGameData === undefined) {
                        this.myGameData = null;
                    }
                    if (this.globalAddtion === undefined) {
                        this.globalAddtion = null;
                    }
                    if (this.reward === undefined) {
                        this.reward = null;
                    }
                    if (this.materials === undefined) {
                        this.materials = null;
                    }
                    if (this.ownChefs === undefined) {
                        this.ownChefs = null;
                    }
                    if (this.ownRecipes === undefined) {
                        this.ownRecipes = null;
                    }
                    if (this.ownEquips === undefined) {
                        this.ownEquips = null;
                    }
                    if (this.tempOwnRecipes === undefined) {
                        this.tempOwnRecipes = null;
                    }
                    this.needType = ["Bake", "Steam", "Boil", "Fry", "Knife", "Stirfry", "UseKnife", "UseSteam", "UseBoil", "UseBake", "UseStirfry", "UseFry", "UseFish", "UseCreation", "UseMeat", "UseVegetable"];
                    this.playRecipes = new Array();
                    if (this.playChefs === undefined) {
                        this.playChefs = null;
                    }
                    if (this.playEquips === undefined) {
                        this.playEquips = null;
                    }
                    if (this.tempCalCache === undefined) {
                        this.tempCalCache = null;
                    }
                    this.counts = (s => {
                        let a = [];
                        while (s-- > 0)
                            a.push(0);
                        return a;
                    })(7000);
                    this.prices = (s => {
                        let a = [];
                        while (s-- > 0)
                            a.push(0);
                        return a;
                    })(7000);
                    this.materialTag = ["\u7559\u7a7a", "\u8089", "\u9c7c", "\u8089", "\u8089", "\u8089", "\u83dc", "\u8089", "\u8089", "\u8089", "\u83dc", "\u9762", "\u8089", "\u83dc", "\u83dc", "\u83dc", "\u83dc", "\u83dc", "\u83dc", "\u83dc", "\u9762", "\u9762", "\u83dc", "\u83dc", "\u9c7c", "\u83dc", "\u8089", "\u8089", "\u8089", "\u9762", "\u83dc", "\u83dc", "\u9c7c", "\u83dc", "\u9762", "\u9762", "\u83dc", "\u9c7c", "\u8089", "\u8089", "\u8089", "\u9c7c", "\u9c7c", "\u8089", "\u8089", "\u83dc", "\u83dc"];
                    this.reward = rewardlsit;
                    this.materials = materials;
                    this.officialGameData = officialGameData;
                    this.myGameData = myGameData;
                    this.globalAddtion = new com.example.calculation.GlobalAddtion(myGameData.chefs, officialGameData.skills);
                    this.initOwn();
                    GodInference.modifyChefValue(this.ownChefs, this.globalAddtion);
                    this.buildRecipeTags();
                }

                /**
                 * @param {com.example.entity.Chef[]} chefs         厨师数组
                 * @param {com.example.calculation.GlobalAddtion} globalAddtion 全体加成
                 */
                static modifyChefValue(chefs, globalAddtion) {
                    for (let index126 = 0; index126 < chefs.length; index126++) {
                        let chef = chefs[index126];
                        {
                            chef.bake += globalAddtion.bake;
                            chef.boil += globalAddtion.boil;
                            chef.stirfry += globalAddtion.stirfry;
                            chef.steam += globalAddtion.steam;
                            chef.fry += globalAddtion.fry;
                            chef.knife += globalAddtion.knife;
                            const tags = chef.tags;
                            if (tags != null && 0 < /* size */ tags.length) {
                                for (let index127 = 0; index127 < tags.length; index127++) {
                                    let tag = tags[index127];
                                    {
                                        let value = 0;
                                        if (tag === com.example.entity.Chef.SEX_MAN) {
                                            value = globalAddtion.manfill;
                                        } else if (tag === com.example.entity.Chef.SEX_WOMAN) {
                                            value = globalAddtion.womanfill;
                                        }
                                        chef.bake += value;
                                        chef.boil += value;
                                        chef.stirfry += value;
                                        chef.steam += value;
                                        chef.fry += value;
                                        chef.knife += value;
                                    }
                                }
                            }
                        }
                    }
                }

                buildCache() {
                    this.buildIndex();
                    const builder = new com.example.calculation.TempCalCache.builder();
                    builder.init(this.ownChefs, this.ownRecipes, this.ownEquips, this.officialGameData, this.globalAddtion, this.reward);
                    this.tempCalCache = builder.build();
                }

                /**
                 * 有的菜谱id过于大，正常id小于1000，后厨的普遍5000多，如果用一维数组存菜谱id，则有很多空间浪费
                 * 这里做一重排，用从0开始的连续数字代替id
                 */
                buildIndex() {
                    this.recipePermutation(1, ([]), new com.example.calculation.IngredientLimit(this.materials));
                    //this.playRecipes = this.playRecipes.slice(0, 60);
                    console.info("\u6709\u5e8f\u83dc\u8c31\u7ec4\u5408\u6570\u91cf" + this.playRecipes.length);
                    const calRecipes = (function (dims) {
                        let allocate = function (dims) {
                            if (dims.length === 0) {
                                return null;
                            } else {
                                let array = [];
                                for (let i = 0; i < dims[0]; i++) {
                                    array.push(allocate(dims.slice(1)));
                                }
                                return array;
                            }
                        };
                        return allocate(dims);
                    })([this.playRecipes.length, 9]);
                    const maps = ({});
                    for (let i = 0; i < this.playRecipes.length; i++) {
                        {
                            for (let i2 = 0; i2 < 9; i2++) {
                                {
                                    const playRecipe = this.playRecipes[i][i2];
                                    const count = playRecipe.count;
                                    const recepeid = playRecipe.getRecipe().recipeId;
                                    const mapid = count << 14 | recepeid;
                                    let calRecipe = ((m, k) => {
                                        if (m.entries == null)
                                            m.entries = [];
                                        for (let i = 0; i < m.entries.length; i++)
                                            if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
                                                return m.entries[i].value;
                                            }
                                        return null;
                                    })(maps, mapid);
                                    if (calRecipe == null) {
                                        calRecipe = new com.example.entity.CalRecipe(playRecipe.getRecipe(), count);
                                        /* put */
                                        ((m, k, v) => {
                                            if (m.entries == null)
                                                m.entries = [];
                                            for (let i = 0; i < m.entries.length; i++)
                                                if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
                                                    m.entries[i].value = v;
                                                    return;
                                                }
                                            m.entries.push({
                                                key: k, value: v, getKey: function () {
                                                    return this.key;
                                                }, getValue: function () {
                                                    return this.value;
                                                }
                                            });
                                        })(maps, mapid, calRecipe);
                                    }
                                    calRecipes[i][i2] = calRecipe;
                                }
                            }
                        }
                    }
                    console.info("\u83dc\u8c31\u79cd\u7c7b " + /* size */ ((m) => {
                        if (m.entries == null)
                            m.entries = [];
                        return m.entries.length;
                    })(maps));
                    this.compressionAndMapping(maps);
                    this.ownRecipes = (s => {
                        let a = [];
                        while (s-- > 0)
                            a.push(null);
                        return a;
                    })(/* size */((m) => {
                        if (m.entries == null)
                            m.entries = [];
                        return m.entries.length;
                    })(maps));
                    {
                        let array129 = /* entrySet */ ((m) => {
                            if (m.entries == null)
                                m.entries = [];
                            return m.entries;
                        })(maps);
                        for (let index128 = 0; index128 < array129.length; index128++) {
                            let integerCalRecipeEntry = array129[index128];
                            {
                                this.ownRecipes[integerCalRecipeEntry.getValue().index] = integerCalRecipeEntry.getValue();
                            }
                        }
                    }
                }

                compressionAndMapping(maps) {
                    const integers = ((m) => {
                        let r = [];
                        if (m.entries == null)
                            m.entries = [];
                        for (let i = 0; i < m.entries.length; i++)
                            r.push(m.entries[i].key);
                        return r;
                    })(maps);
                    const iterator = ((a) => {
                        var i = 0;
                        return {
                            next: function () {
                                return i < a.length ? a[i++] : null;
                            }, hasNext: function () {
                                return i < a.length;
                            }
                        };
                    })(integers);
                    const ints = (s => {
                        let a = [];
                        while (s-- > 0)
                            a.push(0);
                        return a;
                    })(/* size */ integers.length);
                    for (let i = 0; i < ints.length; i++) {
                        {
                            ints[i] = iterator.next();
                        }
                    }
                    com.example.utils.SortUtils.quickSort(ints);
                    for (let i = 0; i < ints.length; i++) {
                        {
                            const calRecipe = ((m, k) => {
                                if (m.entries == null)
                                    m.entries = [];
                                for (let i = 0; i < m.entries.length; i++)
                                    if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
                                        return m.entries[i].value;
                                    }
                                return null;
                            })(maps, ints[i]);
                            calRecipe.index = i;
                        }
                    }
                }

                /**
                 * 假设: 在没有厨具的情况下得分最高的，在带上厨具后仍然是最高的  虽然不一定，但很可能是一个比较优质的解
                 */
                refere() {
                    if (this.tempCalCache == null) {
                        this.buildCache();
                    }
                    this.buildPermutation();
                    let start;
                    let end;
                    start = Date.now();
                    const total = this.playRecipes.length;
                    const t1 = total * 1.0 / this.segmentnums;
                    const groupnum = (((t1 | 0) < t1 ? t1 + 1 : t1) | 0);
                    const playRecipes2 = (function (dims) {
                        let allocate = function (dims) {
                            if (dims.length === 0) {
                                return 0;
                            } else {
                                let array = [];
                                for (let i = 0; i < dims[0]; i++) {
                                    array.push(allocate(dims.slice(1)));
                                }
                                return array;
                            }
                        };
                        return allocate(dims);
                    })([this.playRecipes.length, 9]);

                    const idToIndex = new Map();
                    for (let i = 0; i < this.ownRecipes.length; i++) {
                        idToIndex.set(this.ownRecipes[i].recipeId, this.ownRecipes[i].index);
                    }

                    for (let i = 0; i < this.playRecipes.length; i++) {
                        let playRecipes = this.playRecipes[i];
                        for (let i2 = 0; i2 < 9; i2++) {
                            playRecipes2[i][i2] = idToIndex.get(playRecipes[i2].getRecipe().recipeId);
                        }
                        com.example.utils.SortUtils.quickSort(playRecipes2[i]);
                    }

                    let topPlayChers = [];
                    let scores = new Array(500000)
                    let scoreIndex = 0;

                    for (let i = 0; i < groupnum; i++) {
                        {
                            let chefAndRecipeThread;
                            if (i === groupnum - 1) {
                                chefAndRecipeThread = new com.example.calculation.ChefAndRecipeThread(i * this.segmentnums, total);
                            } else {
                                chefAndRecipeThread = new com.example.calculation.ChefAndRecipeThread(i * this.segmentnums, (i + 1) * this.segmentnums);
                            }
                            chefAndRecipeThread.setBaseData(playRecipes2, this.playChefs, GodInference.recipe2Change, this.tempCalCache);
                            //  const topResults = chefAndRecipeThread.call();

                            const topResults = chefAndRecipeThread.callWasm();

                            for (let index130 = 0; index130 < topResults.length; index130++) {
                                let topResult = topResults[index130];
                                {
                                    scores[scoreIndex++] = topResult;
                                }
                            }
                            let topKValue = com.example.collection.BFPRT.bfprt(scores, 0, scoreIndex, (scoreIndex - this.topcount) > 0 ? scoreIndex - this.topcount : 0);
                            let newScoreIndex = 0;
                            for (let j = 0; j < scoreIndex; j++) {
                                {
                                    if (scores[j] > topKValue) {
                                        scores[newScoreIndex++] = scores[j];
                                    }
                                }
                            }
                            scoreIndex = newScoreIndex;
                        }
                    }
                    scores = scores.slice(0, scoreIndex);
                    com.example.utils.SortUtils.quickSort(scores);

                    topPlayChers = this.parseLong(playRecipes2, this.playChefs, scores);
                    end = Date.now();
                    console.info("\u5168\u83dc\u8c31 \u5168\u53a8\u5e08 \u65e0\u53a8\u5177\u6392\u5217\u7ed3\u679c\u7528\u65f6:" + (end - start) + "ms");
                    return this.calSecondStage(topPlayChers);
                }

                /**
                 * 保存得分 菜谱，菜谱排列，厨师组合索引   1符号位，20位得分，18位菜谱索引，11位菜谱排列，14位厨师索引
                 * cal = ((((cal << 18 | i) << 11) | k) << 14) | i2;
                 * @param {int[][]} playRecipes
                 * @param {int[][]} playChefs
                 * @param {long[]} socres
                 * @return {com.example.calculation.TopResult[]}
                 */
                parseLong(playRecipes, playChefs, socres) {
                    const disordePermuation = com.example.calculation.ChefAndRecipeThread.disordePermuation_$LI$();
                    const topResults = ([]);
                    let recipeIndex = 0;
                    let permuteIndex = 0;
                    let chefIndex = 0;
                    let score = 0;
                    for (let index131 = 0; index131 < socres.length; index131++) {
                        let socre = socres[index131];
                        {
                            recipeIndex = (socre >> 25n & 262143n);
                            permuteIndex = (socre >> 14n & 2047n);
                            chefIndex = (socre & 16383n);
                            score = ((socre & -17592186044416n) >> 43n);
                            const precipes = playRecipes[recipeIndex];
                            const ints = disordePermuation[permuteIndex];
                            const recipes = [0, 0, 0, 0, 0, 0, 0, 0, 0];
                            recipes[0] = precipes[ints[0]];
                            recipes[1] = precipes[ints[1]];
                            recipes[2] = precipes[ints[2]];
                            recipes[3] = precipes[ints[3]];
                            recipes[4] = precipes[ints[4]];
                            recipes[5] = precipes[ints[5]];
                            recipes[6] = precipes[ints[6]];
                            recipes[7] = precipes[ints[7]];
                            recipes[8] = precipes[ints[8]];
                            const chefs = playChefs[chefIndex];
                            const topResult = new com.example.calculation.TopResult(chefs, recipes, score);
                            /* add */
                            (topResults.push(topResult) > 0);
                        }
                    }
                    return topResults;
                }

                /**
                 * 第二阶段的计算
                 * @param {com.example.calculation.TopResult[]} topPlayChers
                 */
                calSecondStage(topPlayChers) {
                    let max = 0;
                    const topResults = topPlayChers.slice(0);
                    let chefAndRecipeThread;
                    const globalDate = new com.example.entity.GlobalDate();
                    globalDate.ownChefs = this.ownChefs;
                    globalDate.ownEquips = this.ownEquips;
                    globalDate.ownRecipes = this.ownRecipes;
                    globalDate.tempCalCache = this.tempCalCache;
                    chefAndRecipeThread = new com.example.calculation.ChefEquipRecipeThread(this.playEquips, topResults, max, globalDate, 0, topResults.length);
                    let result = chefAndRecipeThread.call();
                    max = result[result.length - 1].score

                    console.info("\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002");
                    console.info("\u53ef\u80fd\u7684\u6700\u9ad8\u5206\u7ec4\u5408\u4e3a" + max);
                    return result
                }

                buildPermutation() {
                    this.playChefs = null;
                    this.playEquips = null;
                    this.playChefs = this.chefsPermutation();
                    console.info("\u53a8\u5e08\u7ec4\u5408\u6570" + this.playChefs.length);
                    this.playEquips = this.equipspermute();
                    console.info("\u53c2\u4e0e\u7ec4\u5408\u7684\u53a8\u5177\u6570" + this.playEquips.length);
                }

                chefsPermutation() {
                    const index2 = ([]);
                    const length = this.ownChefs.length;
                    if (length < 3) {
                        return null;
                    }
                    let result;
                    const temp = ([]);
                    for (let i = 0; i < length; i++) {
                        {
                            for (let j = i + 1; j < length; j++) {
                                {
                                    for (let k = j + 1; k < length; k++) {
                                        {
                                            if (this.ownChefs[i].rarity + this.ownChefs[j].rarity + this.ownChefs[k].rarity >= this.chefMinRaritySum) {
                                                const s = [0, 0, 0];
                                                s[0] = this.ownChefs[i].index;
                                                s[1] = this.ownChefs[j].index;
                                                s[2] = this.ownChefs[k].index;
                                                /* add */
                                                temp.push(s) > 0;
                                            }
                                        }
                                    }
                                    if (index2.length === 0 || temp.length !== index2[ /* size */index2.length - 1]) {
                                        /* add */
                                        (index2.push(/* size */ temp.length) > 0);
                                    }
                                }
                            }
                        }
                    }
                    result = /* toArray */ ((a1, a2) => {
                        if (a1.length >= a2.length) {
                            a1.length = 0;
                            a1.push.apply(a1, a2);
                            return a1;
                        } else {
                            return a2.slice(0);
                        }
                    })((function (dims) {
                        let allocate = function (dims) {
                            if (dims.length === 0) {
                                return 0;
                            } else {
                                let array = [];
                                for (let i = 0; i < dims[0]; i++) {
                                    array.push(allocate(dims.slice(1)));
                                }
                                return array;
                            }
                        };
                        return allocate(dims);
                    })([0, 0]), temp);

                    GodInference.recipe2Change = new Array(index2.length + 1).fill(0);
                    for (let i = 0; i < index2.length; i++) {
                        {
                            GodInference.recipe2Change[i + 1] = /* get */ index2[i];
                        }
                    }
                    return result;
                }

                equipspermute() {
                    const index2 = ([]);
                    const length = this.ownEquips.length;
                    if (length < 3) {
                        return [];
                    }
                    const totalLength = (com.example.utils.MathExtend.A(length, 3) | 0);
                    const roots = ([]);

                    const result = new Array(totalLength);
                    for (let i = 0; i < totalLength; i++) {
                        result[i] = new Array(3);
                    }

                    let position = 0;
                    for (let i = 0; i < length; ++i) {
                        {
                            const root = new com.example.collection.EquipTree();
                            root.index = this.ownEquips[i].index;
                            if (i > 0 && this.ownEquips[i].index === this.ownEquips[i - 1].index) {
                                continue;
                            }
                            const roots2 = [];
                            for (let i2 = 0; i2 < length; i2++) {
                                {
                                    if (i2 === i) {
                                        continue;
                                    }
                                    const root2 = new com.example.collection.EquipTree();
                                    root2.index = this.ownEquips[i2].index;
                                    /* add */
                                    roots2.push(root2);
                                    const root3 = [];
                                    for (let i3 = 0; i3 < length; i3++) {
                                        {
                                            if (i3 === i || i3 === i2) {
                                                continue;
                                            }
                                            if (i3 > 0 && this.ownEquips[i3].index !== this.ownEquips[i3 - 1].index) {
                                                result[position][0] = this.ownEquips[i].index;
                                                result[position][1] = this.ownEquips[i2].index;
                                                result[position++][2] = this.ownEquips[i3].index;
                                                /* add */
                                                root3.push(this.ownEquips[i3].index)
                                            }
                                        }
                                    }
                                    root2.leaves = root3;
                                    if (index2.length === 0 || position !== index2[index2.length - 1]) {
                                        index2.push(position)
                                    }
                                }
                            }
                            root.children = roots2.slice(0);
                            if (root.children != null) {
                                (roots.push(root) > 0);
                            }
                        }
                    }
                    const result2 = roots.slice(0);
                    GodInference.equip2Change = (s => {
                        let a = [];
                        while (s-- > 0)
                            a.push(0);
                        return a;
                    })(index2.length);
                    for (let i7 = 0; i7 < GodInference.equip2Change.length; i7++) {
                        {
                            GodInference.equip2Change[i7] = /* get */ index2[i7];
                        }
                    }
                    return result2;
                }

                recipePermutation(index, play, ingredientLimit) {
                    if (index === 10) {
                        this.playRecipes.push(play);
                        return;
                    }
                    const limit = this.deepLimit[index];
                    const finalMaterialCount = ingredientLimit.getFinalMaterialCount();
                    const integerIntegerMap = this.calQuantity(finalMaterialCount);
                    this.SortOfprice(integerIntegerMap, this.tempOwnRecipes);
                    const removes = ([]);
                    for (let i = 0; i < limit; i++) {
                        {
                            const selectRecipe = this.tempOwnRecipes.shift();
                            /* add */
                            (removes.push(selectRecipe) > 0);
                            const quantity = integerIntegerMap[selectRecipe.recipeId];
                            const newplay = ([]);
                            /* addAll */
                            ((l1, l2) => l1.push.apply(l1, l2))(newplay, play);
                            ingredientLimit.cookingQuanttiy(selectRecipe, quantity);
                            const clone = ingredientLimit.getFinalMaterialCount();
                            const p = new com.example.calculation.PlayRecipe(selectRecipe, quantity);
                            /* add */
                            (newplay.push(p) > 0);
                            this.recipePermutation(index + 1, newplay, ingredientLimit);
                            ingredientLimit.setMaterialCount(clone);
                        }
                    }
                    for (let it = 0; it < /* size */ removes.length; it++) {
                        {
                            this.tempOwnRecipes.push(/* get */ removes[it]);
                        }
                    }
                }

                /**
                 * @param {int[]} materialCount 各种食材的剩余数量,数组下标对应食材的id
                 * @return {int[]}
                 */
                calQuantity(materialCount) {
                    const maxequiplimit = this.globalAddtion.maxequiplimit;
                    const length = this.tempOwnRecipes.length;
                    let ownRecipe;
                    for (let i = 0; i < length; i++) {
                        {
                            ownRecipe = this.tempOwnRecipes[i];
                            const count = com.example.calculation.IngredientLimit.cookingQuanttiy(ownRecipe.materials2, ownRecipe.limit + maxequiplimit[ownRecipe.rarity], materialCount);
                            this.counts[ownRecipe.recipeId] = count;
                        }

                    }
                    return this.counts;
                }

                SortOfprice(quanttiy, recipes) {
                    for (let index132 = 0; index132 < recipes.length; index132++) {
                        let ownRecipe = recipes[index132];
                        {
                            const rew = this.reward[ownRecipe.recipeId];
                            this.prices[ownRecipe.recipeId] = (Math.ceil(ownRecipe.price * (1 + rew) * quanttiy[ownRecipe.recipeId]) | 0);
                        }
                    }
                    recipes.sort((r1, r2) => {
                        return this.prices[r2.recipeId] - this.prices[r1.recipeId];
                    });
                }

                buildRecipeTags() {
                    for (let index133 = 0; index133 < this.tempOwnRecipes.length; index133++) {
                        let ownRecipe = this.tempOwnRecipes[index133];
                        {
                            const materials = ownRecipe.materials;
                            const tags = [0, 0, 0, 0];
                            for (let index134 = 0; index134 < materials.length; index134++) {
                                let material = materials[index134];
                                {
                                    switch ((this.materialTag[material.material])) {
                                        case "\u9762":
                                            tags[0] = 1;
                                            break;
                                        case "\u8089":
                                            tags[1] = 1;
                                            break;
                                        case "\u83dc":
                                            tags[2] = 1;
                                            break;
                                        case "\u9c7c":
                                            tags[3] = 1;
                                            break;
                                        default:
                                            break;
                                    }
                                }
                            }
                            ownRecipe.tags = tags;
                        }
                    }
                }

                initOwn() {
                    const chefs = ([]);
                    const sort = this.myGameData.chefs.filter((chef) => {
                        return chef.rarity >= 2;

                    }).sort((chef, chef2) => {
                        return chef2.rarity - chef.rarity;
                    });
                    sort.forEach((chef) => {
                        /* add */
                        (chefs.push(chef) > 0);
                    });
                    this.ownChefs = /* toArray */ chefs.slice(0);
                    const tempEquips = ([]);
                    const equips = this.myGameData.equips;
                    for (let index135 = 0; index135 < equips.length; index135++) {
                        let equip = equips[index135];
                        {
                            if ( /* contains */(equip.origin.indexOf("\u65b0\u624b\u5956\u6c60") != -1) && equip.rarity >= 2 && equip.rarity <= 3) {
                                /* add */
                                (tempEquips.push(equip) > 0);
                                /* add */
                                (tempEquips.push(equip) > 0);
                            } else if ( /* contains */(equip.origin.indexOf("\u4e2d\u7ea7\u5956\u6c60") != -1) && equip.rarity >= this.equipMinRarity && equip.rarity <= this.equipMaxRarity) {
                                /* add */
                                (tempEquips.push(equip) > 0);
                            } else if (!(equip.origin.indexOf("\u74a7\u6c60") != -1) && !(equip.origin.indexOf("\u9650\u65f6\u793c\u5305") != -1) && !(equip.origin.indexOf("\u5723\u8bde\u5956\u6c60") != -1) && !(equip.origin.indexOf("\u6709\u751f\u4e4b\u5e74\u6c60") != -1)) {
                                if (equip.rarity >= this.equipMinRarity && equip.rarity <= this.equipMaxRarity) {
                                    /* add */
                                    (tempEquips.push(equip) > 0);
                                }
                            }
                        }
                    }
                    this.ownEquips = /* toArray */ tempEquips.slice(0);
                    const recipes = this.myGameData.recipes;
                    const recipes1 = (s => {
                        let a = [];
                        while (s-- > 0)
                            a.push(null);
                        return a;
                    })(this.myGameData.recipes.length);

                    for (let i = 0; i < recipes1.length; i++) {
                        {
                            recipes1[i] = recipes[i];
                        }
                    }

                    this.tempOwnRecipes = this.myGameData.recipes;

                    for (let tempOwnRecipe of this.tempOwnRecipes) {
                        if (tempOwnRecipe == null) {
                            console.log(tempOwnRecipe)
                        }
                        tempOwnRecipe.materials2 = tempOwnRecipe.materials

                    }
                }
            }

            GodInference.recipe2Change = null;
            GodInference.equip2Change = null;
            calculation.GodInference = GodInference;
            GodInference["__class"] = "com.example.calculation.GodInference";
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            class IngredientLimit {
                constructor(m) {
                    if (((m != null && m instanceof Array && (m.length == 0 || m[0] == null || (typeof m[0] === 'number'))) || m === null)) {
                        let __args = arguments;
                        this.materialCount = (s => {
                            let a = [];
                            while (s-- > 0)
                                a.push(0);
                            return a;
                        })(47);
                        this.extraLimit = [0, 0, 0, 0, 0, 0];
                        if (m.length >= 47) {
                            this.materialCount = m;
                        } else {
                            for (let i = 0; i < this.materialCount.length; i++) {
                                {
                                    this.materialCount[i] = 50;
                                }
                            }
                        }
                    } else if (((typeof m === 'number') || m === null)) {
                        let ingredientNum = arguments[0];
                        this.materialCount = (s => {
                            let a = [];
                            while (s-- > 0)
                                a.push(0);
                            return a;
                        })(47);
                        this.extraLimit = [0, 0, 0, 0, 0, 0];
                        for (let i = 0; i < this.materialCount.length; i++) {
                            {
                                this.materialCount[i] = ingredientNum;
                            }
                        }
                    } else if (m === undefined) {
                        {
                            let ingredientNum = 2147483647;
                            this.materialCount = (s => {
                                let a = [];
                                while (s-- > 0)
                                    a.push(0);
                                return a;
                            })(47);
                            this.extraLimit = [0, 0, 0, 0, 0, 0];
                            for (let i = 0; i < this.materialCount.length; i++) {
                                {
                                    this.materialCount[i] = ingredientNum;
                                }
                            }
                        }
                        this.materialCount = (s => {
                            let a = [];
                            while (s-- > 0)
                                a.push(0);
                            return a;
                        })(47);
                        this.extraLimit = [0, 0, 0, 0, 0, 0];
                    } else
                        throw new Error('invalid overload');
                }

                static __static_initialize() {
                    if (!IngredientLimit.__static_initialized) {
                        IngredientLimit.__static_initialized = true;
                        IngredientLimit.__static_initializer_0();
                    }
                }

                static cacheResult_$LI$() {
                    IngredientLimit.__static_initialize();
                    if (IngredientLimit.cacheResult == null) {
                        IngredientLimit.cacheResult = (function (dims) {
                            let allocate = function (dims) {
                                if (dims.length === 0) {
                                    return 0;
                                } else {
                                    let array = [];
                                    for (let i = 0; i < dims[0]; i++) {
                                        array.push(allocate(dims.slice(1)));
                                    }
                                    return array;
                                }
                            };
                            return allocate(dims);
                        })([1000, 50]);
                    }
                    return IngredientLimit.cacheResult;
                }

                static __static_initializer_0() {
                    for (let i = 0; i < IngredientLimit.cacheResult_$LI$().length; i++) {
                        {
                            for (let j = 1; j < IngredientLimit.cacheResult_$LI$()[i].length; j++) {
                                {
                                    IngredientLimit.cacheResult_$LI$()[i][j] = (i / j | 0);
                                }
                            }
                        }
                    }
                }

                cookingQuanttiy(recipe, expected) {
                    const limit = recipe.limit + this.extraLimit[recipe.rarity];
                    expected = expected < limit ? expected : limit;
                    return IngredientLimit.cookingQuanttiyAndReduce(/* toArray */((a1, a2) => {
                        if (a1.length >= a2.length) {
                            a1.length = 0;
                            a1.push.apply(a1, a2);
                            return a1;
                        } else {
                            return a2.slice(0);
                        }
                    })([], recipe.materials), expected, this.materialCount);
                }

                static cookingQuanttiy(materials, expected, materialCount) {
                    let max = expected;
                    let t;
                    const length = materials.length;
                    for (let i = 0; i < length; i++) {
                        {
                            const material = materials[i];
                            t = IngredientLimit.cacheResult_$LI$()[materialCount[material.material]][material.quantity];
                            max = t < max ? t : max;
                        }
                    }
                    return max;
                }

                static cookingQuanttiyAndReduce(materials, expected, materialCount) {
                    let max = expected;
                    let t;
                    const length = materials.length;
                    for (let i = 0; i < length; i++) {
                        {
                            const material = materials[i];
                            t = IngredientLimit.cacheResult_$LI$()[materialCount[material.material]][material.quantity];
                            max = t < max ? t : max;
                            materialCount[material.material] -= material.quantity * max;
                        }
                    }
                    return max;
                }

                getFinalMaterialCount() {
                    return /* clone */ this.materialCount.slice(0);
                }

                setMaterialCount(materialCount) {
                    this.materialCount = materialCount;
                }
            }

            IngredientLimit.__static_initialized = false;
            calculation.IngredientLimit = IngredientLimit;
            IngredientLimit["__class"] = "com.example.calculation.IngredientLimit";
            IngredientLimit["__interfaces"] = ["java.lang.Cloneable"];
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            class PlayChef {
                constructor(chef) {
                    if (((chef != null && chef instanceof com.example.entity.Chef) || chef === null)) {
                        if (this.id === undefined) {
                            this.id = 0;
                        }
                        if (this.chef === undefined) {
                            this.chef = null;
                        }
                        if (this.equip === undefined) {
                            this.equip = null;
                        }
                        if (this.effect === undefined) {
                            this.effect = null;
                        }
                        if (this.effectCache === undefined) {
                            this.effectCache = null;
                        }
                        this.recipes = null;
                        this.chef = chef;
                    } else if (chef === undefined) {
                        if (this.id === undefined) {
                            this.id = 0;
                        }
                        if (this.chef === undefined) {
                            this.chef = null;
                        }
                        if (this.equip === undefined) {
                            this.equip = null;
                        }
                        if (this.effect === undefined) {
                            this.effect = null;
                        }
                        if (this.effectCache === undefined) {
                            this.effectCache = null;
                        }
                        this.recipes = null;
                    } else
                        throw new Error('invalid overload');
                }


                setChef(chef) {
                    this.chef = /* clone */ /* clone */ ((o) => {
                        if (o.clone != undefined) {
                            return o.clone();
                        } else {
                            let clone = Object.create(o);
                            for (let p in o) {
                                if (o.hasOwnProperty(p))
                                    clone[p] = o[p];
                            }
                            return clone;
                        }
                    })(chef);
                }

                setRecipes(recipes) {
                    this.recipes = recipes;
                }


                setEquip(equip) {
                    this.equip = equip;
                }

                /**
                 *
                 * @return {com.example.calculation.PlayChef}
                 */
                clone() {
                    let old = null;
                    try {
                        old = ((o) => {
                            let clone = Object.create(o);
                            for (let p in o) {
                                if (o.hasOwnProperty(p))
                                    clone[p] = o[p];
                            }
                            return clone;
                        })(this);
                    } catch (e) {
                        console.error(e.message, e);
                    }
                    return old;
                }

                /**
                 *
                 * @return {string}
                 */
                toString() {
                    if (this.equip != null) {
                        return "{\"chef\": \"" + this.chef.name + "\", \"recipes\":" + this.recipes.toString() + "\", \"equip\": \"" + this.equip.name + "\"" + '}';
                    }
                    return "{\"chef\": \"" + this.chef.name + "\", \"recipes\":" + this.recipes.toString() + "\", \"equip\": \"\"" + '}';
                }
            }

            calculation.PlayChef = PlayChef;
            PlayChef["__class"] = "com.example.calculation.PlayChef";
            PlayChef["__interfaces"] = ["java.lang.Cloneable"];
            (function (PlayChef) {
                class builder {
                    constructor() {
                        if (this.officialGameData === undefined) {
                            this.officialGameData = null;
                        }
                        if (this.chefname === undefined) {
                            this.chefname = null;
                        }
                        if (this.equipname === undefined) {
                            this.equipname = null;
                        }
                        if (this.recipenames === undefined) {
                            this.recipenames = null;
                        }
                        if (this.cookingQuantity === undefined) {
                            this.cookingQuantity = null;
                        }
                    }

                    setPlay(chefname, equipname, ...params) {
                        this.chefname = chefname;
                        this.equipname = equipname;
                        this.recipenames = params;
                        return this;
                    }

                    setQuantity(...params) {
                        this.cookingQuantity = params;
                        return this;
                    }

                    setGameData(officialGameData) {
                        this.officialGameData = officialGameData;
                        return this;
                    }

                    build() {
                        const playChef = new com.example.calculation.PlayChef();
                        const recipes = this.officialGameData.recipes;
                        const chefs = this.officialGameData.chefs;
                        const equips = this.officialGameData.equips;
                        const playRecipes = (s => {
                            let a = [];
                            while (s-- > 0)
                                a.push(null);
                            return a;
                        })(this.recipenames.length);
                        for (let i = 0, index = 0; i < this.recipenames.length; i++) {
                            {
                                const recipename = this.recipenames[i];
                                for (let index137 = 0; index137 < recipes.length; index137++) {
                                    let recipe = recipes[index137];
                                    {
                                        if (recipe.name === recipename) {
                                            const playRecipe = new com.example.calculation.PlayRecipe(recipe, this.cookingQuantity[i]);
                                            playRecipes[index++] = playRecipe;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        playChef.setRecipes(playRecipes);
                        for (let index138 = 0; index138 < chefs.length; index138++) {
                            let chef = chefs[index138];
                            {
                                if (chef.name === this.chefname) {
                                    playChef.setChef(chef);
                                    break;
                                }
                            }
                        }
                        for (let index139 = 0; index139 < equips.length; index139++) {
                            let equip = equips[index139];
                            {
                                if (equip.name === this.equipname) {
                                    playChef.setEquip(equip);
                                    break;
                                }
                            }
                        }
                        return playChef;
                    }
                }

                PlayChef.builder = builder;
                builder["__class"] = "com.example.calculation.PlayChef.builder";
            })(PlayChef = calculation.PlayChef || (calculation.PlayChef = {}));
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            class PlayRecipe {
                constructor(recipe, count) {
                    if (this.id === undefined) {
                        this.id = 0;
                    }
                    if (this.recipe === undefined) {
                        this.recipe = null;
                    }
                    if (this.count === undefined) {
                        this.count = 0;
                    }
                    if (this.singeprice === undefined) {
                        this.singeprice = 0;
                    }
                    if (this.totalprice === undefined) {
                        this.totalprice = 0;
                    }
                    this.recipe = recipe;
                    this.count = count;
                    this.id = recipe.recipeId;
                }

                /**
                 *
                 * @return {com.example.calculation.PlayRecipe}
                 */
                clone() {
                    let old = null;
                    try {
                        old = ((o) => {
                            let clone = Object.create(o);
                            for (let p in o) {
                                if (o.hasOwnProperty(p))
                                    clone[p] = o[p];
                            }
                            return clone;
                        })(this);
                    } catch (e) {
                        console.error(e.message, e);
                    }
                    return old;
                }

                getRecipe() {
                    return this.recipe;
                }


                /**
                 *
                 * @return {string}
                 */
                toString() {
                    return "{\"recipe\" : \"" + this.recipe.name + "\", \"count\" :" + this.count + '}';
                }
            }

            calculation.PlayRecipe = PlayRecipe;
            PlayRecipe["__class"] = "com.example.calculation.PlayRecipe";
            PlayRecipe["__interfaces"] = ["java.lang.Cloneable"];
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            class SkillEffect {
                constructor() {
                    this.canCal = true;
                    if (this.bake === undefined) {
                        this.bake = 0;
                    }
                    if (this.boil === undefined) {
                        this.boil = 0;
                    }
                    if (this.stirfry === undefined) {
                        this.stirfry = 0;
                    }
                    if (this.knife === undefined) {
                        this.knife = 0;
                    }
                    if (this.fry === undefined) {
                        this.fry = 0;
                    }
                    if (this.steam === undefined) {
                        this.steam = 0;
                    }
                    if (this.bakePercent === undefined) {
                        this.bakePercent = 0;
                    }
                    if (this.boilPercent === undefined) {
                        this.boilPercent = 0;
                    }
                    if (this.stirfryPercent === undefined) {
                        this.stirfryPercent = 0;
                    }
                    if (this.knifePercent === undefined) {
                        this.knifePercent = 0;
                    }
                    if (this.fryPercent === undefined) {
                        this.fryPercent = 0;
                    }
                    if (this.steamPercent === undefined) {
                        this.steamPercent = 0;
                    }
                    if (this.usebake === undefined) {
                        this.usebake = 0;
                    }
                    if (this.useboil === undefined) {
                        this.useboil = 0;
                    }
                    if (this.usestirfry === undefined) {
                        this.usestirfry = 0;
                    }
                    if (this.useknife === undefined) {
                        this.useknife = 0;
                    }
                    if (this.usefry === undefined) {
                        this.usefry = 0;
                    }
                    if (this.usesteam === undefined) {
                        this.usesteam = 0;
                    }
                    if (this.usefish === undefined) {
                        this.usefish = 0;
                    }
                    if (this.usecreation === undefined) {
                        this.usecreation = 0;
                    }
                    if (this.usemeat === undefined) {
                        this.usemeat = 0;
                    }
                    if (this.usevegetable === undefined) {
                        this.usevegetable = 0;
                    }
                    if (this.goldgain === undefined) {
                        this.goldgain = 0;
                    }
                    this.tempAddtion = null;
                }

                /**
                 *
                 * @return {com.example.calculation.SkillEffect}
                 */
                clone() {
                    let old = null;
                    try {
                        old = ((o) => {
                            let clone = Object.create(o);
                            for (let p in o) {
                                if (o.hasOwnProperty(p))
                                    clone[p] = o[p];
                            }
                            return clone;
                        })(this);
                    } catch (e) {
                        console.error(e.message, e);
                    }
                    return old;
                }

                effect(effect) {
                    if ("Partial" === effect.condition) {
                        if (this.tempAddtion == null) {
                            this.tempAddtion = new com.example.calculation.TempAddtion();
                        }
                        switch ((effect.type)) {
                            case "Bake":
                                this.tempAddtion.bake += effect.value;
                                break;
                            case "Steam":
                                this.tempAddtion.steam += effect.value;
                                break;
                            case "Boil":
                                this.tempAddtion.boil += effect.value;
                                break;
                            case "Fry":
                                this.tempAddtion.fry += effect.value;
                                break;
                            case "Knife":
                                this.tempAddtion.knife += effect.value;
                                break;
                            case "Stirfry":
                                this.tempAddtion.stirfry += effect.value;
                                break;
                            default:
                                break;
                        }
                    } else if ("Self" === effect.condition) {
                        switch ((effect.type)) {
                            case "Bake":
                                if (effect.cal === ("Abs")) {
                                    this.bake += effect.value;
                                } else if (effect.cal === ("Percent")) {
                                    this.bakePercent += /* doubleValue */ effect.value / 100;
                                }
                                break;
                            case "Steam":
                                if (effect.cal === ("Abs")) {
                                    this.steam += effect.value;
                                } else if (effect.cal === ("Percent")) {
                                    this.steamPercent += /* doubleValue */ effect.value / 100;
                                }
                                break;
                            case "Boil":
                                if (effect.cal === ("Abs")) {
                                    this.boil += effect.value;
                                } else if (effect.cal === ("Percent")) {
                                    this.boilPercent += ( /* doubleValue */effect.value / 100);
                                }
                                break;
                            case "Fry":
                                if (effect.cal === ("Abs")) {
                                    this.fry += effect.value;
                                } else if (effect.cal === ("Percent")) {
                                    this.fryPercent += ( /* doubleValue */effect.value / 100);
                                }
                                break;
                            case "Knife":
                                if (effect.cal === ("Abs")) {
                                    this.knife += effect.value;
                                } else if (effect.cal === ("Percent")) {
                                    this.knifePercent += /* doubleValue */ effect.value / 100;
                                }
                                break;
                            case "Stirfry":
                                if (effect.cal === ("Abs")) {
                                    this.stirfry += effect.value;
                                } else if (effect.cal === ("Percent")) {
                                    this.stirfryPercent += /* doubleValue */ effect.value / 100;
                                }
                                break;
                            case "UseBake":
                                this.usebake += /* doubleValue */ effect.value / 100;
                                break;
                            case "UseSteam":
                                this.usesteam += /* doubleValue */ effect.value / 100;
                                break;
                            case "UseBoil":
                                this.useboil += /* doubleValue */ effect.value / 100;
                                break;
                            case "UseFry":
                                this.usefry += /* doubleValue */ effect.value / 100;
                                break;
                            case "UseKnife":
                                this.useknife += /* doubleValue */ effect.value / 100;
                                break;
                            case "UseStirfry":
                                this.usestirfry += /* doubleValue */ effect.value / 100;
                                break;
                            case "UseFish":
                                this.usefish += /* doubleValue */ effect.value / 100;
                                break;
                            case "UseCreation":
                                this.usecreation += /* doubleValue */ effect.value / 100;
                                break;
                            case "UseMeat":
                                this.usemeat += /* doubleValue */ effect.value / 100;
                                break;
                            case "UseVegetable":
                                this.usevegetable += /* doubleValue */ effect.value / 100;
                                break;
                            case "Gold_Gain":
                                this.goldgain += /* doubleValue */ effect.value / 100;
                                break;
                            default:
                                break;
                        }
                    }
                }

                globalEffect(globalAddtion) {
                    this.bake += globalAddtion.bake;
                    this.boil += globalAddtion.boil;
                    this.stirfry += globalAddtion.stirfry;
                    this.knife += globalAddtion.knife;
                    this.fry += globalAddtion.fry;
                    this.steam += globalAddtion.steam;
                }

                templeEffect(tempAddtion) {
                    this.bake += tempAddtion.bake;
                    this.boil += tempAddtion.boil;
                    this.stirfry += tempAddtion.stirfry;
                    this.knife += tempAddtion.knife;
                    this.fry += tempAddtion.fry;
                    this.steam += tempAddtion.steam;
                }

                calSkill() {
                    if (this.canCal) {
                    }
                    this.canCal = false;
                }

                addEffect(effect) {
                    this.usesteam += effect.usesteam;
                    this.useboil += effect.useboil;
                    this.usefry += effect.usefry;
                    this.useknife += effect.useknife;
                    this.usestirfry += effect.usestirfry;
                    this.usebake += effect.usebake;
                    this.usefish += effect.usefish;
                    this.usecreation += effect.usecreation;
                    this.usemeat += effect.usemeat;
                    this.usevegetable += effect.usevegetable;
                    this.goldgain += effect.goldgain;
                    this.bake += effect.bake;
                    this.boil += effect.boil;
                    this.stirfry += effect.stirfry;
                    this.knife += effect.knife;
                    this.fry += effect.fry;
                    this.steam += effect.steam;
                    this.bakePercent += effect.bakePercent;
                    this.boilPercent += effect.boilPercent;
                    this.stirfryPercent += effect.stirfryPercent;
                    this.knifePercent += effect.knifePercent;
                    this.fryPercent += effect.fryPercent;
                    this.steamPercent += effect.steamPercent;
                    if (effect.tempAddtion != null) {
                        if (this.tempAddtion == null) {
                            this.tempAddtion = new com.example.calculation.TempAddtion();
                        }
                        this.tempAddtion.bake += effect.tempAddtion.bake;
                        this.tempAddtion.boil += effect.tempAddtion.boil;
                        this.tempAddtion.stirfry += effect.tempAddtion.stirfry;
                        this.tempAddtion.knife += effect.tempAddtion.knife;
                        this.tempAddtion.fry += effect.tempAddtion.fry;
                        this.tempAddtion.steam += effect.tempAddtion.steam;
                    }
                }

                reset() {
                    this.usesteam = 0;
                    this.useboil = 0;
                    this.usefry = 0;
                    this.useknife = 0;
                    this.usestirfry = 0;
                    this.usebake = 0;
                    this.usefish = 0;
                    this.usecreation = 0;
                    this.usemeat = 0;
                    this.usevegetable = 0;
                    this.goldgain = 0;
                    this.bake = 0;
                    this.boil = 0;
                    this.stirfry = 0;
                    this.knife = 0;
                    this.fry = 0;
                    this.steam = 0;
                    this.bakePercent = 0;
                    this.boilPercent = 0;
                    this.stirfryPercent = 0;
                    this.knifePercent = 0;
                    this.fryPercent = 0;
                    this.steamPercent = 0;
                    if (this.tempAddtion != null) {
                        this.tempAddtion.bake = 0;
                        this.tempAddtion.boil = 0;
                        this.tempAddtion.stirfry = 0;
                        this.tempAddtion.knife = 0;
                        this.tempAddtion.fry = 0;
                        this.tempAddtion.steam = 0;
                    }
                }
            }

            calculation.SkillEffect = SkillEffect;
            SkillEffect["__class"] = "com.example.calculation.SkillEffect";
            SkillEffect["__interfaces"] = ["java.lang.Cloneable"];
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            class TempAddtion {
                constructor() {
                    if (this.bake === undefined) {
                        this.bake = 0;
                    }
                    if (this.boil === undefined) {
                        this.boil = 0;
                    }
                    if (this.stirfry === undefined) {
                        this.stirfry = 0;
                    }
                    if (this.knife === undefined) {
                        this.knife = 0;
                    }
                    if (this.fry === undefined) {
                        this.fry = 0;
                    }
                    if (this.steam === undefined) {
                        this.steam = 0;
                    }
                }
            }

            calculation.TempAddtion = TempAddtion;
            TempAddtion["__class"] = "com.example.calculation.TempAddtion";
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            /**
             * @param {number} chefIndexMax   厨师id的最大值
             * @param {number} recipeIndexMax 菜谱id的最大值,一般整个计算过程中实际会用的菜谱数量不会超过100，可以将菜谱id做亚索
             * @param {number} equipIndexMax  设备id的最大值
             * @class
             * @author hushuaibo
             */
            class TempCalCache {
                constructor(chefIndexMax, equipIndexMax, recipeIndexMax) {
                    if (((typeof chefIndexMax === 'number') || chefIndexMax === null) && ((typeof equipIndexMax === 'number') || equipIndexMax === null) && ((typeof recipeIndexMax === 'number') || recipeIndexMax === null)) {
                        if (this.chefCount === undefined) {
                            this.chefCount = 0;
                        }
                        if (this.recipeCount === undefined) {
                            this.recipeCount = 0;
                        }
                        if (this.equipCount === undefined) {
                            this.equipCount = 0;
                        }
                        this.scoreCache = null;
                        this.socreCacheNoEquip = null;
                        this.socreAddCacheNoEquip = null;
                        this.socreCacheNoEquipIndex = null;
                        this.addSkill = null;
                        this.addSkill2 = null;
                        this.scoreGroupCache = null;
                        this.qualityAdd = [-1.0, 0.0, 0.1, 0.3, 0.5, 1.0];
                        this.qualityAddS = null;
                        this.qualityAddQ = null;
                        this.chefCount = chefIndexMax;
                        this.recipeCount = recipeIndexMax;
                        this.equipCount = equipIndexMax;
                        this.scoreCache = (function (dims) {
                            let allocate = function (dims) {
                                if (dims.length === 0) {
                                    return 0;
                                } else {
                                    let array = [];
                                    for (let i = 0; i < dims[0]; i++) {
                                        array.push(allocate(dims.slice(1)));
                                    }
                                    return array;
                                }
                            };
                            return allocate(dims);
                        })([chefIndexMax, equipIndexMax, recipeIndexMax]);
                        this.qualityAddS = (function (dims) {
                            let allocate = function (dims) {
                                if (dims.length === 0) {
                                    return 0;
                                } else {
                                    let array = [];
                                    for (let i = 0; i < dims[0]; i++) {
                                        array.push(allocate(dims.slice(1)));
                                    }
                                    return array;
                                }
                            };
                            return allocate(dims);
                        })([chefIndexMax, equipIndexMax, recipeIndexMax]);
                        this.qualityAddQ = (function (dims) {
                            let allocate = function (dims) {
                                if (dims.length === 0) {
                                    return 0;
                                } else {
                                    let array = [];
                                    for (let i = 0; i < dims[0]; i++) {
                                        array.push(allocate(dims.slice(1)));
                                    }
                                    return array;
                                }
                            };
                            return allocate(dims);
                        })([chefIndexMax, equipIndexMax, recipeIndexMax]);
                        this.socreCacheNoEquip = (function (dims) {
                            let allocate = function (dims) {
                                if (dims.length === 0) {
                                    return 0;
                                } else {
                                    let array = [];
                                    for (let i = 0; i < dims[0]; i++) {
                                        array.push(allocate(dims.slice(1)));
                                    }
                                    return array;
                                }
                            };
                            return allocate(dims);
                        })([chefIndexMax, recipeIndexMax]);
                        this.addSkill = (function (dims) {
                            let allocate = function (dims) {
                                if (dims.length === 0) {
                                    return false;
                                } else {
                                    let array = [];
                                    for (let i = 0; i < dims[0]; i++) {
                                        array.push(allocate(dims.slice(1)));
                                    }
                                    return array;
                                }
                            };
                            return allocate(dims);
                        })([chefIndexMax, recipeIndexMax]);
                        this.socreCacheNoEquipIndex = (function (dims) {
                            let allocate = function (dims) {
                                if (dims.length === 0) {
                                    return 0;
                                } else {
                                    let array = [];
                                    for (let i = 0; i < dims[0]; i++) {
                                        array.push(allocate(dims.slice(1)));
                                    }
                                    return array;
                                }
                            };
                            return allocate(dims);
                        })([this.recipeCount, this.recipeCount]);
                    } else if (chefIndexMax === undefined && equipIndexMax === undefined && recipeIndexMax === undefined) {
                        if (this.chefCount === undefined) {
                            this.chefCount = 0;
                        }
                        if (this.recipeCount === undefined) {
                            this.recipeCount = 0;
                        }
                        if (this.equipCount === undefined) {
                            this.equipCount = 0;
                        }
                        this.scoreCache = null;
                        this.socreCacheNoEquip = null;
                        this.socreAddCacheNoEquip = null;
                        this.socreCacheNoEquipIndex = null;
                        this.addSkill = null;
                        this.addSkill2 = null;
                        this.scoreGroupCache = null;
                        this.qualityAdd = [-1.0, 0.0, 0.1, 0.3, 0.5, 1.0];
                        this.qualityAddS = null;
                        this.qualityAddQ = null;
                    } else
                        throw new Error('invalid overload');
                }
            }

            calculation.TempCalCache = TempCalCache;
            TempCalCache["__class"] = "com.example.calculation.TempCalCache";
            (function (TempCalCache) {
                class builder {
                    constructor() {
                        if (this.tempCalCache === undefined) {
                            this.tempCalCache = null;
                        }
                        this.reward = null;
                        this.officialGameData = null;
                        this.globalAddtion = null;
                        this.kitchenGodCal = null;
                        this.ownChefs = null;
                        this.ownRecipes = null;
                        this.ownEquips = null;
                        this.tempEffect = new com.example.calculation.SkillEffect();
                    }

                    init(ownChefs, ownRecipes, ownEquips, officialGameData, globalAddtion, reward) {
                        this.officialGameData = officialGameData;
                        this.globalAddtion = globalAddtion;
                        this.kitchenGodCal = new com.example.calculation.CacheKitchenGodCal();
                        this.ownChefs = ownChefs;
                        this.ownRecipes = ownRecipes;
                        this.ownEquips = ownEquips;
                        this.reward = reward;
                        this.tempCalCache = new com.example.calculation.TempCalCache(ownChefs.length, ownEquips.length, ownRecipes.length);
                    }

                    updateIdAndAddEffect() {
                        for (let i = 0; i < this.ownChefs.length; i++) {
                            {
                                const ownChef = this.ownChefs[i];
                                ownChef.index = i;
                                this.buildEffect$com_example_entity_Chef(ownChef);
                            }

                        }
                        for (let i = 0; i < this.ownEquips.length; i++) {
                            {
                                const ownEquip = this.ownEquips[i];
                                ownEquip.index = i;
                                this.buildEffect$com_example_entity_Equip(ownEquip);
                            }

                        }
                    }

                    build() {
                        this.updateIdAndAddEffect();
                        this.initCache();
                        return this.tempCalCache;
                    }

                    initCache() {
                        const scoreCache = this.tempCalCache.scoreCache;
                        const socreCacheNoEquip = this.tempCalCache.socreCacheNoEquip;
                        const qualityAddQ1 = this.tempCalCache.qualityAddQ;
                        const qualityAddS1 = this.tempCalCache.qualityAddS;
                        const addSkill = this.tempCalCache.addSkill;
                        let skillEffect;
                        let qualityAddQ;
                        let qualityAddS;
                        let price;
                        let singleprice;
                        const useall = this.globalAddtion.useall;
                        for (let i = 0; i < this.ownChefs.length; i++) {
                            {
                                const ownChef = this.ownChefs[i];
                                skillEffect = ownChef.skillEffect;
                                for (let i3 = 0; i3 < this.ownRecipes.length; i3++) {
                                    {
                                        const ownRecipe = this.ownRecipes[i3];
                                        const index = ownRecipe.index;
                                        const r = this.kitchenGodCal.QualityAddNoEquip(ownChef, skillEffect, ownRecipe);
                                        qualityAddQ = r[0];
                                        const hasAdd = r[1] === 1 ? true : false;
                                        addSkill[i][index] = hasAdd;
                                        if (qualityAddQ === -1) {
                                            socreCacheNoEquip[i][index] = 0;
                                            continue;
                                        }
                                        qualityAddS = this.kitchenGodCal.skillAdd(skillEffect, ownRecipe);
                                        price = ownRecipe.price;
                                        singleprice = (Math.ceil(price * (1 + this.reward[ownRecipe.recipeId] + qualityAddQ + qualityAddS + useall[ownRecipe.rarity])) | 0);
                                        socreCacheNoEquip[i][index] = singleprice * ownRecipe.count;
                                    }

                                }
                            }

                        }
                        for (let i = 0; i < this.ownChefs.length; i++) {
                            {
                                const ownChef = this.ownChefs[i];
                                for (let i2 = 0; i2 < this.ownEquips.length; i2++) {
                                    {
                                        const ownEquip = this.ownEquips[i2];
                                        skillEffect = this.MergerSkillEffect(ownChef, ownEquip);
                                        for (let i3 = 0; i3 < this.ownRecipes.length; i3++) {
                                            {
                                                const ownRecipe = this.ownRecipes[i3];
                                                const index = ownRecipe.index;
                                                qualityAddQ = this.kitchenGodCal.QualityAdd(ownChef, skillEffect, ownRecipe);
                                                if (qualityAddQ === -1) {
                                                    qualityAddQ1[i][i2][index] = 0;
                                                    qualityAddS1[i][i2][index] = 0;
                                                    scoreCache[i][i2][index] = 0;
                                                    continue;
                                                }
                                                qualityAddS = this.kitchenGodCal.skillAdd(skillEffect, ownRecipe);
                                                price = ownRecipe.price;
                                                singleprice = (Math.ceil(price * (1 + this.reward[ownRecipe.recipeId] + qualityAddQ + qualityAddS + useall[ownRecipe.rarity])) | 0);
                                                qualityAddQ1[i][i2][index] = qualityAddQ;
                                                qualityAddS1[i][i2][index] = qualityAddS;
                                                scoreCache[i][i2][index] = singleprice * ownRecipe.count;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        let indexs = 0;
                        const length = this.tempCalCache.recipeCount;
                        for (let i = 0; i < length; i++) {
                            {
                                for (let j = i + 1; j < length; j++) {
                                    {
                                        for (let k = j + 1; k < length; k++) {
                                            {
                                                indexs++;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        this.tempCalCache.socreAddCacheNoEquip = (function (dims) {
                            let allocate = function (dims) {
                                if (dims.length === 0) {
                                    return 0;
                                } else {
                                    let array = [];
                                    for (let i = 0; i < dims[0]; i++) {
                                        array.push(allocate(dims.slice(1)));
                                    }
                                    return array;
                                }
                            };
                            return allocate(dims);
                        })([this.tempCalCache.chefCount, indexs]);
                        const socreAddCacheNoEquip = this.tempCalCache.socreAddCacheNoEquip;
                        const socreCacheNoEquipIndex = this.tempCalCache.socreCacheNoEquipIndex;
                        for (let t = 0; t < this.tempCalCache.chefCount; t++) {
                            {
                                let index = 0;
                                for (let i = 0; i < length; i++) {
                                    {
                                        for (let j = i + 1; j < length; j++) {
                                            {
                                                socreCacheNoEquipIndex[i][j] = index;
                                                for (let k = j + 1; k < length; k++) {
                                                    {
                                                        let score;
                                                        if (scoreCacheNoEquip[t][i] == 0 || scoreCacheNoEquip[t][j] == 0 || scoreCacheNoEquip[t][k] == 0) {
                                                            //三道菜只要有一道菜做不了，一定不是最优解
                                                            score = 0;
                                                        } else {
                                                            score = scoreCacheNoEquip[t][i] + scoreCacheNoEquip[t][j] + scoreCacheNoEquip[t][k];
                                                        }
                                                        socreAddCacheNoEquip[t][index++] = score;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    buildEffect$com_example_entity_Chef(chef) {
                        const skillEffect = new com.example.calculation.SkillEffect();
                        let skill = this.officialGameData.getSkill(chef.skill);
                        let effect = skill.effect;
                        for (let index140 = 0; index140 < effect.length; index140++) {
                            let effect1 = effect[index140];
                            {
                                skillEffect.effect(effect1);
                            }
                        }
                        const ultimateId = chef.ultimateSkill;
                        if (ultimateId != null) {
                            skill = this.officialGameData.getSkill(ultimateId);
                            if (skill != null) {
                                effect = skill.effect;
                                for (let index141 = 0; index141 < effect.length; index141++) {
                                    let effect1 = effect[index141];
                                    {
                                        skillEffect.effect(effect1);
                                    }
                                }
                            }
                        }
                        chef.skillEffect = skillEffect;
                        return skillEffect;
                    }

                    buildEffect(chef) {
                        if (((chef != null && chef instanceof com.example.entity.Chef) || chef === null)) {
                            return this.buildEffect$com_example_entity_Chef(chef);
                        } else if (((chef != null && chef instanceof com.example.entity.Equip) || chef === null)) {
                            return this.buildEffect$com_example_entity_Equip(chef);
                        } else
                            throw new Error('invalid overload');
                    }

                    buildEffect$com_example_entity_Equip(equip) {
                        const skillEffect = new com.example.calculation.SkillEffect();
                        const skills = equip.skill;
                        for (let index142 = 0; index142 < skills.length; index142++) {
                            let skill = skills[index142];
                            {
                                const skill1 = this.officialGameData.getSkill(skill);
                                const effect = skill1.effect;
                                for (let index143 = 0; index143 < effect.length; index143++) {
                                    let effect1 = effect[index143];
                                    {
                                        skillEffect.effect(effect1);
                                    }
                                }
                            }
                        }
                        equip.skillEffect = skillEffect;
                        return skillEffect;
                    }

                    MergerSkillEffect(chef, equip) {
                        this.tempEffect.reset();
                        const skillEffect = this.tempEffect;
                        const skillEffect1 = chef.skillEffect;
                        const skillEffect2 = equip.skillEffect;
                        skillEffect.addEffect(skillEffect1);
                        skillEffect.addEffect(skillEffect2);
                        return skillEffect;
                    }
                }

                TempCalCache.builder = builder;
                builder["__class"] = "com.example.calculation.TempCalCache.builder";
            })(TempCalCache = calculation.TempCalCache || (calculation.TempCalCache = {}));
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var calculation;
        (function (calculation) {
            /**
             * @author hushuaibo
             * @date 2020/9/26 18:12
             * <p>
             * 对象头 12字节
             * chefs  4
             * equipid 4
             * recepeids 4
             * score 4字节
             * 填充 4字节
             * <p>
             * 32字节
             * <p>
             * recepeids指向的数组为 56字节
             * chefs和equipid指向的数组是复用的不做计算
             * @param {int[]} playChefs
             * @param {int[]} recipeindex
             * @param {number} score
             * @class
             */
            class TopResult {
                constructor(playChefs, recipeindex, score) {
                    if (this.chefs === undefined) {
                        this.chefs = null;
                    }
                    if (this.equipid === undefined) {
                        this.equipid = null;
                    }
                    if (this.recepeids === undefined) {
                        this.recepeids = null;
                    }
                    if (this.id === undefined) {
                        this.id = 0;
                    }
                    if (this.score === undefined) {
                        this.score = 0;
                    }
                    this.update(playChefs, recipeindex, score);
                }

                update(playChefs, recipeindex, score) {
                    this.chefs = playChefs;
                    this.recepeids = recipeindex;
                    this.score = score;
                }
            }

            calculation.TopResult = TopResult;
            TopResult["__class"] = "com.example.calculation.TopResult";
        })(calculation = example.calculation || (example.calculation = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var collection;
        (function (collection) {
            class BFPRT {
                /**
                 * The recursive procedure in BFPRT.
                 *
                 * 找第i小的数
                 *
                 *
                 * @param {long[]} arr The array from which select.
                 * @param {number} p   The start index of the sub-array from which select.
                 * @param {number} r   The end index of the sub-array from which select.
                 * @param {number} i   The order of the element to be selected.
                 * @return {number} The selected element.
                 */
                static bfprt(arr, p, r, i) {
                    if (p === r) {
                        return arr[p];
                    }
                    const pivot = BFPRT.medianOfMedians(arr, p, r);
                    const pivotRange = BFPRT.partition(arr, p, r, pivot);
                    if (p + i >= pivotRange[0] && p + i <= pivotRange[1]) {
                        return arr[pivotRange[0]];
                    } else if (p + i < pivotRange[0]) {
                        return BFPRT.bfprt(arr, p, pivotRange[0] - 1, i);
                    } else {
                        return BFPRT.bfprt(arr, pivotRange[1] + 1, r, i + p - pivotRange[1] - 1);
                    }
                }

                /**
                 * Compute the median of the medians of the input array.
                 *
                 * @param {long[]} arr The array to be computed.
                 * @param {number} p   The start index of the sub-array.
                 * @param {number} r   The end index of the sub-array.
                 * @return {number} The median of the medians of the sub-array.
                 */
                static medianOfMedians(arr, p, r) {
                    const num = r - p + 1;
                    const extra = num % 5 === 0 ? 0 : 1;
                    let medians = new Array((num / 5 | 0) + extra);
                    for (let i = 0; i < medians.length; i++) {
                        {
                            medians[i] = BFPRT.computeMedian(arr, p + i * 5, Math.min(p + i * 5 + 4, r));
                        }
                    }
                    return BFPRT.bfprt(medians, 0, medians.length - 1, (medians.length / 2 | 0));
                }

                /**
                 * Partition the array into two parts.
                 * <p>
                 * After this method, elements less than pivot are put left, pivots are put middle, others are put right.
                 *
                 * @param {long[]} arr The array to be sorted.
                 * @param {number} p   The start index of the sub-array to be sorted.
                 * @param {number} r   The end index of the sub-array to be sorted.
                 * @return {int[]} A two elements array. The first element indicates the index of the first pivot, the second element
                 * indicates the index of the last pivot.
                 * @param {number} pivot
                 */
                static partition(arr, p, r, pivot) {
                    let small = p - 1;
                    let equal = 0;
                    let temp;
                    for (let j = p; j <= r; j++) {
                        {
                            if (arr[j] < pivot) {
                                small++;
                                temp = arr[small];
                                arr[small] = arr[j];
                                if (equal > 0) {
                                    arr[j] = arr[small + equal];
                                    arr[small + equal] = temp;
                                } else {
                                    arr[j] = temp;
                                }
                            } else if (arr[j] === pivot) {
                                equal++;
                                temp = arr[j];
                                arr[j] = arr[small + equal];
                                arr[small + equal] = temp;
                            }
                        }
                    }
                    return [small + 1, small + equal];
                }

                /**
                 * Compute the median of the given array.
                 *
                 * @param {long[]} arr   Array to be computed.
                 * @param {number} begin The begin index of the range to be computed.
                 * @param {number} end   The end index of the range to be computed.
                 * @return {number} The median of the array in the specified range.
                 */
                static computeMedian(arr, begin, end) {
                    com.example.utils.SortUtils.shellSort(arr, begin, end);
                    return arr[begin + ((end - begin) / 2 | 0)];
                }
            }

            collection.BFPRT = BFPRT;
            BFPRT["__class"] = "com.example.collection.BFPRT";
        })(collection = example.collection || (example.collection = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var collection;
        (function (collection) {
            /**
             * @author hushuaibo
             * @date 2021/2/13 13:01
             * @class
             */
            class EquipTree {
                constructor() {
                    if (this.index === undefined) {
                        this.index = 0;
                    }
                    if (this.children === undefined) {
                        this.children = null;
                    }
                    if (this.leaves === undefined) {
                        this.leaves = null;
                    }
                }
            }

            collection.EquipTree = EquipTree;
            EquipTree["__class"] = "com.example.collection.EquipTree";
        })(collection = example.collection || (example.collection = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            /**
             * @author hushuaibo
             * @date 2020/9/29 10:48
             * <p>
             * <p>
             * 对于不同数量的
             *
             *
             *
             * 一个菜谱两种技法，多种食材
             * @param {com.example.entity.Recipe} recipe
             * @param {number} count
             * @class
             */
            class CalRecipe {
                constructor(recipe, count) {
                    if (this.index === undefined) {
                        this.index = 0;
                    }
                    if (this.id === undefined) {
                        this.id = 0;
                    }
                    if (this.count === undefined) {
                        this.count = 0;
                    }
                    if (this.recipeId === undefined) {
                        this.recipeId = 0;
                    }
                    if (this.name === undefined) {
                        this.name = null;
                    }
                    if (this.stirfry === undefined) {
                        this.stirfry = 0;
                    }
                    if (this.boil === undefined) {
                        this.boil = 0;
                    }
                    if (this.knife === undefined) {
                        this.knife = 0;
                    }
                    if (this.fry === undefined) {
                        this.fry = 0;
                    }
                    if (this.bake === undefined) {
                        this.bake = 0;
                    }
                    if (this.steam === undefined) {
                        this.steam = 0;
                    }
                    if (this.rarity === undefined) {
                        this.rarity = 0;
                    }
                    if (this.price === undefined) {
                        this.price = 0;
                    }
                    if (this.exPrice === undefined) {
                        this.exPrice = 0;
                    }
                    if (this.tags === undefined) {
                        this.tags = null;
                    }
                    if (this.attributeTags === undefined) {
                        this.attributeTags = null;
                    }
                    this.count = count;
                    this.recipeId = recipe.recipeId;
                    this.name = recipe.name;
                    this.stirfry = recipe.stirfry;
                    this.boil = recipe.boil;
                    this.knife = recipe.knife;
                    this.fry = recipe.fry;
                    this.bake = recipe.bake;
                    this.steam = recipe.steam;
                    this.price = recipe.price;
                    this.exPrice = recipe.exPrice;
                    this.rarity = recipe.rarity;
                    this.tags = recipe.tags;
                    this.id = count << 14 | this.recipeId;
                }

                /**
                 * 通过菜谱id和菜谱数量 确定菜谱是否相同
                 * @param {*} o
                 * @return {boolean}
                 */
                equals(o) {
                    if (this === o)
                        return true;
                    if (!(o != null && o instanceof com.example.entity.CalRecipe))
                        return false;
                    const calRecipe = o;
                    if (this.count !== calRecipe.count)
                        return false;
                    return this.recipeId === calRecipe.recipeId;
                }

                /**
                 * count<<14|recipeid;
                 * @return {number}
                 */
                hashCode() {
                    return this.id;
                }

                /**
                 *
                 * @return {string}
                 */
                toString() {
                    return "{\"recipe\" : \"" + this.name + "\", \"count\" :" + this.count + '}';
                }
            }

            entity.CalRecipe = CalRecipe;
            CalRecipe["__class"] = "com.example.entity.CalRecipe";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            /**
             * 厨师
             * @class
             */
            class Chef {
                constructor() {
                    if (this.index === undefined) {
                        this.index = 0;
                    }
                    if (this.chefId === undefined) {
                        this.chefId = 0;
                    }
                    if (this.galleryId === undefined) {
                        this.galleryId = null;
                    }
                    if (this.name === undefined) {
                        this.name = null;
                    }
                    if (this.origin === undefined) {
                        this.origin = null;
                    }
                    if (this.rarity === undefined) {
                        this.rarity = 0;
                    }
                    if (this.bake === undefined) {
                        this.bake = 0;
                    }
                    if (this.boil === undefined) {
                        this.boil = 0;
                    }
                    if (this.stirfry === undefined) {
                        this.stirfry = 0;
                    }
                    if (this.knife === undefined) {
                        this.knife = 0;
                    }
                    if (this.fry === undefined) {
                        this.fry = 0;
                    }
                    if (this.steam === undefined) {
                        this.steam = 0;
                    }
                    if (this.creation === undefined) {
                        this.creation = 0;
                    }
                    if (this.fish === undefined) {
                        this.fish = 0;
                    }
                    if (this.meat === undefined) {
                        this.meat = 0;
                    }
                    if (this.veg === undefined) {
                        this.veg = 0;
                    }
                    if (this.skill === undefined) {
                        this.skill = null;
                    }
                    if (this.ultimateGoal === undefined) {
                        this.ultimateGoal = null;
                    }
                    if (this.ultimateSkill === undefined) {
                        this.ultimateSkill = null;
                    }
                    if (this.tags === undefined) {
                        this.tags = null;
                    }
                    if (this.equip === undefined) {
                        this.equip = null;
                    }
                    if (this.skillEffect === undefined) {
                        this.skillEffect = null;
                    }
                }

                /**
                 *
                 * @return {com.example.entity.Chef}
                 */
                clone() {
                    let chef1 = null;
                    try {
                        chef1 = ((o) => {
                            let clone = Object.create(o);
                            for (let p in o) {
                                if (o.hasOwnProperty(p))
                                    clone[p] = o[p];
                            }
                            return clone;
                        })(this);
                    } catch (e) {
                        console.error(e.message, e);
                    }
                    return chef1;
                }
            }

            Chef.SEX_MAN = 1;
            Chef.SEX_WOMAN = 2;
            entity.Chef = Chef;
            Chef["__class"] = "com.example.entity.Chef";
            Chef["__interfaces"] = ["java.lang.Cloneable", "java.io.Serializable"];
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            /**
             * Auto-generated: 2020-06-28 15:53:41
             *
             * @author bejson.com (i@bejson.com)
             * @website http://www.bejson.com/java2pojo/
             * @class
             */
            class Effect {
                constructor() {
                    if (this.type === undefined) {
                        this.type = null;
                    }
                    if (this.value === undefined) {
                        this.value = null;
                    }
                    if (this.condition === undefined) {
                        this.condition = null;
                    }
                    if (this.cal === undefined) {
                        this.cal = null;
                    }
                    if (this.rarity === undefined) {
                        this.rarity = null;
                    }
                    if (this.tag === undefined) {
                        this.tag = null;
                    }
                }
            }

            entity.Effect = Effect;
            Effect["__class"] = "com.example.entity.Effect";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            /**
             * Auto-generated: 2020-06-28 15:48:43
             *
             * @author bejson.com (i@bejson.com)
             * @website http://www.bejson.com/java2pojo/
             * @class
             */
            class Equip {
                constructor() {
                    if (this.index === undefined) {
                        this.index = 0;
                    }
                    if (this.equipId === undefined) {
                        this.equipId = 0;
                    }
                    if (this.galleryId === undefined) {
                        this.galleryId = null;
                    }
                    if (this.name === undefined) {
                        this.name = null;
                    }
                    if (this.rarity === undefined) {
                        this.rarity = 0;
                    }
                    if (this.skill === undefined) {
                        this.skill = null;
                    }
                    if (this.origin === undefined) {
                        this.origin = null;
                    }
                    if (this.skillEffect === undefined) {
                        this.skillEffect = null;
                    }
                }
            }

            entity.Equip = Equip;
            Equip["__class"] = "com.example.entity.Equip";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            /**
             * @author
             * @date 2020/10/4 22:33
             * @class
             */
            class GlobalDate {
                constructor() {
                    if (this.ownChefs === undefined) {
                        this.ownChefs = null;
                    }
                    if (this.ownRecipes === undefined) {
                        this.ownRecipes = null;
                    }
                    if (this.ownEquips === undefined) {
                        this.ownEquips = null;
                    }
                    if (this.tempCalCache === undefined) {
                        this.tempCalCache = null;
                    }
                }
            }

            entity.GlobalDate = GlobalDate;
            GlobalDate["__class"] = "com.example.entity.GlobalDate";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            class Ingredient {
                constructor() {
                    if (this.materialId === undefined) {
                        this.materialId = 0;
                    }
                    if (this.name === undefined) {
                        this.name = null;
                    }
                    if (this.origin === undefined) {
                        this.origin = null;
                    }
                }
            }

            entity.Ingredient = Ingredient;
            Ingredient["__class"] = "com.example.entity.Ingredient";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            /**
             * @author
             * @date 2021/3/13 22:40
             * @class
             */
            class Material {
                constructor() {
                    if (this.material === undefined) {
                        this.material = 0;
                    }
                    if (this.quantity === undefined) {
                        this.quantity = 0;
                    }
                }
            }

            entity.Material = Material;
            Material["__class"] = "com.example.entity.Material";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            class MyGameData {
                constructor() {
                    this.chefsMap = ({});
                    this.recipesMap = ({});
                    this.equipsMap = ({});
                    this.chefs = (new Array());
                    this.equips = (new Array());
                    this.recipes = (new Array());
                }
            }

            entity.MyGameData = MyGameData;
            MyGameData["__class"] = "com.example.entity.MyGameData";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            /**
             * Auto-generated: 2020-06-28 15:53:41
             *
             * @author bejson.com (i@bejson.com)
             * @website http://www.bejson.com/java2pojo/
             * @class
             */
            class OfficialGameData {
                constructor() {
                    if (this.recipes === undefined) {
                        this.recipes = null;
                    }
                    if (this.materials === undefined) {
                        this.materials = null;
                    }
                    if (this.chefs === undefined) {
                        this.chefs = null;
                    }
                    if (this.equips === undefined) {
                        this.equips = null;
                    }
                    if (this.skills === undefined) {
                        this.skills = null;
                    }
                    this.equipHashMap = (new Map());
                    this.skillHashMap = (new Map());
                    this.ChefHashMap = (new Map());
                    this.RecipeHashMap = (new Map());
                }

                buildMap() {
                    for (let index144 = 0; index144 < this.recipes.length; index144++) {
                        let x = this.recipes[index144];
                        {
                            this.RecipeHashMap.set(x.recipeId, x);
                        }
                    }
                    for (let index145 = 0; index145 < this.equips.length; index145++) {
                        let x = this.equips[index145];
                        {
                            this.equipHashMap.set(x.equipId, x);
                        }
                    }
                    for (let index146 = 0; index146 < this.skills.length; index146++) {
                        let x = this.skills[index146];
                        {
                            this.skillHashMap.set(x.skillId, x);
                        }
                    }
                    for (let index147 = 0; index147 < this.chefs.length; index147++) {
                        let x = this.chefs[index147];
                        {
                            this.ChefHashMap.set(x.chefId, x);
                        }
                    }
                }

                getSkill(id) {
                    return this.skillHashMap.get(id);
                }
            }

            entity.OfficialGameData = OfficialGameData;
            OfficialGameData["__class"] = "com.example.entity.OfficialGameData";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            /**
             * Auto-generated: 2020-06-28 15:53:41
             *
             * @author bejson.com (i@bejson.com)
             * @website http://www.bejson.com/java2pojo/
             * @class
             */
            class Recipe {
                constructor() {
                    if (this.index === undefined) {
                        this.index = 0;
                    }
                    if (this.recipeId === undefined) {
                        this.recipeId = 0;
                    }
                    if (this.galleryId === undefined) {
                        this.galleryId = null;
                    }
                    if (this.name === undefined) {
                        this.name = null;
                    }
                    if (this.rarity === undefined) {
                        this.rarity = 0;
                    }
                    if (this.unlock === undefined) {
                        this.unlock = null;
                    }
                    if (this.stirfry === undefined) {
                        this.stirfry = 0;
                    }
                    if (this.boil === undefined) {
                        this.boil = 0;
                    }
                    if (this.knife === undefined) {
                        this.knife = 0;
                    }
                    if (this.fry === undefined) {
                        this.fry = 0;
                    }
                    if (this.bake === undefined) {
                        this.bake = 0;
                    }
                    if (this.steam === undefined) {
                        this.steam = 0;
                    }
                    if (this.materials === undefined) {
                        this.materials = null;
                    }
                    if (this.materials2 === undefined) {
                        this.materials2 = null;
                    }
                    if (this.price === undefined) {
                        this.price = 0;
                    }
                    if (this.exPrice === undefined) {
                        this.exPrice = 0;
                    }
                    if (this.time === undefined) {
                        this.time = 0;
                    }
                    if (this.limit === undefined) {
                        this.limit = 0;
                    }
                    if (this.origin === undefined) {
                        this.origin = null;
                    }
                    if (this.gift === undefined) {
                        this.gift = null;
                    }
                    if (this.sortPrice === undefined) {
                        this.sortPrice = 0;
                    }
                    if (this.materialRatio === undefined) {
                        this.materialRatio = 0;
                    }
                    this.tags = [0, 0, 0, 0];
                }
            }

            entity.Recipe = Recipe;
            Recipe["__class"] = "com.example.entity.Recipe";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var entity;
        (function (entity) {
            /**
             * Auto-generated: 2020-06-28 15:53:41
             *
             * @author bejson.com (i@bejson.com)
             * @website http://www.bejson.com/java2pojo/
             * @class
             */
            class Skill {
                constructor() {
                    if (this.skillId === undefined) {
                        this.skillId = 0;
                    }
                    if (this.desc === undefined) {
                        this.desc = null;
                    }
                    if (this.effect === undefined) {
                        this.effect = null;
                    }
                    if (this.skillEffect === undefined) {
                        this.skillEffect = null;
                    }
                }
            }

            entity.Skill = Skill;
            Skill["__class"] = "com.example.entity.Skill";
        })(entity = example.entity || (example.entity = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var utils;
        (function (utils) {
            /**
             * @author hushuaibo
             * @date 2020/10/3 13:34
             * @class
             */
            class MathExtend {
                /**
                 * 排列组合
                 * A（M,N） 如A(3,2) 则参数 m=3,n=2 结果为
                 *
                 *
                 *
                 * @param {number} m
                 * @param {number} n
                 * @return {number}
                 */
                static A(m, n) {
                    let tmp = m;
                    let result = m;
                    let count = 0;
                    while ((count < n - 1)) {
                        {
                            if (n === 1) {
                                return n;
                            } else {
                                count++;
                                tmp--;
                                result = result * tmp;
                            }
                        }
                    }
                    return result;
                }
            }

            utils.MathExtend = MathExtend;
            MathExtend["__class"] = "com.example.utils.MathExtend";
        })(utils = example.utils || (example.utils = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
(function (com) {
    var example;
    (function (example) {
        var utils;
        (function (utils) {
            /**
             * @author hushuaibo
             * @date 2020/9/29 17:36
             * @class
             */
            class SortUtils {
                static shellSort(arr, start, end) {
                    let len = end - start + 1;
                    // gap 即为增量
                    for (let gap = Math.floor(len / 2); gap > 0; gap = Math.floor(gap / 2)) {
                        for (let i = start + gap; i <= end; i++) {
                            let j = i;
                            let current = arr[i];
                            while (j - gap >= start && current < arr[j - gap]) {
                                arr[j] = arr[j - gap];
                                j = j - gap;
                            }
                            arr[j] = current;
                        }
                    }
                }

                static quickSort(array) {
                    const stack = (s => {
                        let a = [];
                        while (s-- > 0)
                            a.push(0);
                        return a;
                    })(array.length * 2);
                    let top = 0;
                    let low = 0;
                    let high = array.length - 1;
                    let par = SortUtils.partion(array, low, high);
                    if (par > low + 1) {
                        stack[top++] = low;
                        stack[top++] = par - 1;
                    }
                    if (par < high - 1) {
                        stack[top++] = par + 1;
                        stack[top++] = high;
                    }
                    while ((top > 0)) {
                        {
                            high = stack[--top];
                            low = stack[--top];
                            par = SortUtils.partion(array, low, high);
                            if (par > low + 1) {
                                stack[top++] = low;
                                stack[top++] = par - 1;
                            }
                            if (par < high - 1) {
                                stack[top++] = par + 1;
                                stack[top++] = high;
                            }
                        }
                    }
                }

                /*private*/
                static partion(array, low, high) {
                    const temp = array[low];
                    while ((low < high)) {
                        {
                            while (((low < high) && temp <= array[high])) {
                                {
                                    high--;
                                }
                            }
                            if (low >= high) {
                                break;
                            } else {
                                array[low] = array[high];
                            }
                            while (((low < high) && array[low] <= temp)) {
                                {
                                    low++;
                                }
                            }
                            if (low === high) {
                                break;
                            } else {
                                array[high] = array[low];
                            }
                        }
                    }
                    array[low] = temp;
                    return low;
                }

                static sort(arr) {
                    for (let i = 1; i < arr.length; i++) {
                        {
                            for (let j = 0; j < arr.length - 1; j++) {
                                {
                                    if (arr[j] > arr[j + 1]) {
                                        const temp = arr[j];
                                        arr[j] = arr[j + 1];
                                        arr[j + 1] = temp;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            utils.SortUtils = SortUtils;
            SortUtils["__class"] = "com.example.utils.SortUtils";
        })(utils = example.utils || (example.utils = {}));
    })(example = com.example || (com.example = {}));
})(com || (com = {}));
com.example.calculation.IngredientLimit.cacheResult_$LI$();
com.example.calculation.IngredientLimit.__static_initialize();
com.example.calculation.ChefAndRecipeThread.disordePermuation_$LI$();
com.example.calculation.ChefAndRecipeThread.__static_initialize();

async function start() {

    let data = await (await fetch('./json/gameData.json')).json();
    let myEquipdata = await (await fetch('./json/myequips.json')).json();
    let myGameData = await (await fetch('./json/myGameData.json')).json();
    let rewardAndCount = await (await fetch('https://bcjh.xyz/api/get_rule?time=2021-02-12T05%3A00%3A00.000Z')).json();
    let officialGameData = new com.example.entity.OfficialGameData();


    officialGameData.chefs = data.chefs;
    officialGameData.equips = data.equips;
    officialGameData.materials = data.materials;
    officialGameData.recipes = data.recipes;
    officialGameData.skills = data.skills;
    officialGameData.buildMap();


    myGameData.equips = myEquipdata;

    let myGameData1 = importChefsAndRecipesFromFoodGame(officialGameData, myGameData);

    return com.example.App.main(officialGameData, myGameData1, rewardAndCount);

}


//从图鉴网导入数据
function importChefsAndRecipesFromFoodGame(officialGameData, foodgameData) {
    let myGameData = new com.example.entity.MyGameData();
    let recipes = foodgameData.recipes;

    let size = recipes.length;
    //菜谱
    for (let i = 0; i < size; i++) {
        let jsonRecipe = recipes[i];
        let id = jsonRecipe.id;

        if (jsonRecipe.got == "是") {
            let recipe = officialGameData.RecipeHashMap.get(id);
            if (recipe != null) {
                if (jsonRecipe.ex == "是") {
                    recipe.price = recipe.price + recipe.exPrice;
                }
                myGameData.recipes.push(recipe);
            }
        }
    }


    //厨师
    let chefs = foodgameData.chefs;
    size = chefs.length;
    for (let i = 0; i < size; i++) {
        let jsonchef = chefs[i];

        let id = jsonchef.id;
        let chef = officialGameData.ChefHashMap.get(id);
        if (chef != null && jsonchef.got == "是") {
            if (jsonchef.ult != "是") {
                chef.ultimateSkill = null;
            }
            myGameData.chefs.push(chef);
        }
    }
    let equipmentData = foodgameData.equips;
    let officialequips = officialGameData.equips;
    //厨具
    size = equipmentData.length;


    for (let equip of officialequips) {
        for (let i = 0; i < size; i++) {
            let equipname = equipmentData[i];
            if (equip.name == equipname) {
                myGameData.equips.push(equip);
                break;
            }
        }
    }
    return myGameData;
}

function arrayToIntMemorySegment(arrays) {
    let length1 = arrays.length;
    let length2 = arrays[0].length;
    let size = (length1 * length2 + 2);
    // 返回的prt是相对于module内存段起始位置的偏移量，可以当作，1偏移 = 1字节
    let ptr = Module._malloc(size * 4);
    let segment = new Int32Array(size);
    let index = 0;

    segment[index++] = length1;
    segment[index++] = length2;

    for (let i = 0; i < length1; i++) {
        for (let i2 = 0; i2 < length2; i2++) {
            segment[index++] = arrays[i][i2];
        }
    }

    //这里要除以4， 因为  HEAP32是32位，所以 1偏移 = 4字节
    Module.HEAP32.set(segment, ptr >> 2);
    return ptr;
}

function arrayToShortMemorySegment(arrays) {
    let length1 = arrays.length;
    let length2 = arrays[0].length;
    let size = (length1 * length2 + 2);
    let segment = new Int16Array(size);
    let ptr = Module._malloc(size * 2);

    let index = 0;

    segment[index++] = length1;
    segment[index++] = length2;

    for (let i = 0; i < length1; i++) {
        for (let i2 = 0; i2 < length2; i2++) {
            segment[index++] = arrays[i][i2];
        }
    }
    Module.HEAP16.set(segment, ptr >> 1);

    return ptr;
}


function getMaterialAndRewardFromJson(jsonObject) {
    let reward = new Array(10000).fill(-100)
    let materialCount = new Array(47);

    const rules = jsonObject.rules;
    for (let i = 0; i < rules.length; i++) {
        let rule = rules[i];
        if (rule.Title != null && rule.Title.indexOf('御前') != -1) {
            let recipeEffect = rule.RecipeEffect;
            for (let key in recipeEffect) {
                reward[key] = recipeEffect[key]
            }
            if (rule.MaterialsLimit instanceof Object) {
                let materials = rule.MaterialsLimit;
                for (let index in materials) {
                    materialCount[index] = materials[index]
                }
            } else {
                let materialsLimit = rule.MaterialsLimit;
                materialCount.fill(materialsLimit);
            }
        }
    }
    return {
        reward,
        materialCount
    }
}
